Selamat datang diblog kami , segala kritik dan saran akan kami terima dengan tulus karena saran anda dapat membantu kami dalam memperbaiki kesalahan dan kekurangan blog ini. TERIMA KASIH TELAH BERKUNJUNG

Kamis, 18 Oktober 2012

How to Open Links in New Window in Blogger


You have to make links open in new window to make visitors staying on your site. Because if a link opens in the same window the visitors leave your site and pay attention to that site (clicked link). 

I search for the code to implement that in this blog I found five methods. I would like to share them here. The following methods will work for websites too.
In the sidebar you may link your favorite websites and in blog posts you may link related websites. For that the following two methods available.

Open a Specific Link in Blank Window:

If you click the link every time it will open in a new blank window. Use the following code.
<a href="http://www.google.com/" target="_blank">Google</a>
This will open google.com in a new blank window. We link google.com in the text Google.

Open a Specific Link in Already Opened Window:

That means for the first time if you click a link it will open in new window. Next time if you click any link it will open in the same new window you already opened. This will look good. Because opening every link in a new blank window may irritate users. The code is given below.


<a href="http://www.google.com/" target="_new">Google</a>
To open all links of your blog in new window the following two techniques are available.

Open All Links in Blank Window:

Put the following code after the <head> tag in your blogger template and save the template.


<base target='_blank' />

Open All Links in Already Opened Windows:

Put the following code after the <head> tag in your Blogger Template and save the template.


<base target='_new' />
The following is a special technique.

Open all External Links in New Window:

If you want to open internal links (your blog links) in the same window and external links (links of other websites) in new window put the following code after the <head> tag and save your template.
<!-- start of external links new window -->
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' type='text/javascript'/>
 <script type='text/javascript'>
 
$(document).ready(function () {

          

                $(&quot;a[href*=&#39;http://&#39;]:not([href*=&#39;&quot;+location.hostname+&quot;&#39;]),[href*=&#39;https://&#39;]:not([href*=&#39;&quot;+location.hostname+&quot;&#39;])&quot;).attr(&quot;target&quot;,&quot;_blank&quot;).attr(&quot;title&quot;,&quot;Opens new window&quot;).addClass(&quot;external&quot;);

    });
    </script>
<!-- end of external links new window -->
For editing your blogger template the following post will help you

Tidak ada komentar:

Posting Komentar