Recent Post

Tuesday, April 15, 2014

-Automatically Open all External Links in a New Window in Blogger-



Automatically Open all External Links in a New Window in Blogger!




Open all external links in a new tab
Follow these easy steps to add this cool dynamic way of updating all external links.
Note: This method works for both blogger and wordpress blogs, irrespective of platforms.
1.    Go to Blogger > Template
2.    Backup your template
3.    Click "Edit HTML"
4.    Just above </head> paste the following script:


<script src='http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' type='text/javascript'></script>
<script type='text/javascript'>
$(document).ready(function() { 
  $("a[href^='http://']").each(
    function(){
     if(this.href.indexOf(location.hostname) == -1) {
        $(this).attr('target', '_blank');
      }
    }
  );
$("a[href^='https://']").each( 
function(){ 
if(this.href.indexOf(location.hostname) == -1) { 
$(this).attr('target', '_blank'); 


);
 
});
</script>


Email Newsletter



Smiley :)
:D
:)
:[
;)
:D
:O
(6)
(A)
:'(
:|
:o)
8)
(K)
(M)

No comments :

Post a Comment