Wednesday, April 6, 2016

Open Links in new tab




Method 1 :Change Links in your each post.

Make or open a Post , in Compose, insert links, change to HTML, inset :  target_blank

<a href="YourLinkUrl" target="windowname">anchor text</a>
Ex :
Before:

<a href="https://drive.google.com/file/d/0B1e4ZfqwlA7EYmFaNnVDcUFiaVU/view?usp=sharing" >https://drive.google.com/file/d/0B1e4ZfqwlA7EYmFaNnVDcUFiaVU/view?usp=sharing</a>

After :

<a href="https://drive.google.com/file/d/0B1e4ZfqwlA7EYmFaNnVDcUFiaVU/view?usp=sharing" target="_blank">https://drive.google.com/file/d/0B1e4ZfqwlA7EYmFaNnVDcUFiaVU/view?usp=sharing</a>

Method 2 : auto change , all links will open in new tab

1.Go to your dashboard.
2.Be forwarded to template>Edit Html.
3.Press Ctrl F then searching for </head>
4.After you found it paste the below code just above it;
<base target='_blank'/>

Method 3 : all links will open in new tab but links you don't want

1.Go to your dashboard.
2.Be forwarded to template>Edit Html.
3.Press Ctrl F then searching for </body>
4.After you found it paste the below code just above it;
<script type="text/javascript">      
//<![CDATA[       
function changetargetlink(x){       
var a = document.getElementsByTagName('a');       
var args = changetargetlink.arguments;       
for(var i in a){       
a[i].target = "_blank";       
a[i].rel = "_blank";       
for(var j=0;j<args.length;j++){       
if(a[i].href.match(args[j])){       
a[i].target = "";       
a[i].rel = "";       
}}}}       
changetargetlink('http://trananhtublog.blogspot.com/search/label/Blogger','http://trananhtublog.blogspot.com/search/label/Softwares');
//]]> </script>
with the link http://trananhtublog.blogspot.com/search/label/Softwares  and http://trananhtublog.blogspot.com/search/label/Blogger , the links will not open in new tab but others

Change upper links with links you don't want to open in new tab

Method 4 : open posts in new tab

Step 1:

Go to Dashboard - Template - Edit HTML

Find for the following line:
<a expr:href='data:post.link'><data:post.title/></a>
Add the tag target='_blank' to this line. Refer to the example below on where you should add it:
<a expr:href='data:post.link' target='_blank'><data:post.title/></a>

Step 2:

Find for the following line now, and add the same tag as in Step 1:
<a expr:href='data:post.url'><data:post.title/></a>
Your line should look like this after the addition of your modification tag:
<a expr:href='data:post.url' target='_blank'><data:post.title/></a>

Important : May be your template more than 1 line, so looking for and change all the line
Ex : my template have 2 codes <a expr:href='data:post.link'><data:post.title/></a>  and 2 codes  <a expr:href='data:post.url'><data:post.title/></a>  so that i change 2nd for each code
Save - > Finish

No comments:

Post a Comment