Make all your links on a webpage to open, in a new tab - with HTML 5

I was looking for some info on web to share, after so many days, i got a new topic.
Well it might not be new for one's, who are familiar with HTML 5 .
Many times , like running a website, we want that links which are posted in comments or link you have added on your site should automatically load without loosing your user to navigate from your website/web page.
For forcing particular links, to be opened in a new tab, attribute TARGET="_BLANK" with tag <A> also known as anchor tag.
Here is an example for it . <a target="_blank">Click this link to open in a new tab</a>, while don't forget to add HREF to the specify reference to link, address.
Consider this example along with TARGET , HREF  <a href="link-location" target="_blank">Click this link to open hyper reference</a>
But that was only to, open a 'Particular' link in a new tab - manually to be done.
My topic was to show, to force all links on a web page, to be opened in a new tab.
We will be using TAG OF HTML 5 i.e <base target='_blank' />
while adding this tag below / after your head section. (Please note :- This tag won't work, if client browser doesn't support HTML 5).
Demo of this code in a simple syntax of html body.

<html>
<head>
<base target='_blank' />
</head>
</html>

This tag can be used on any web page and website.
For Blogger.com user's, simply head on to Dashboard -> Template -> Edit HTML -> Proceed -> Search for tag </head>, By pressing CTRL + F -> Paste the code <base target='_blank' /> -> Save
and it's done :).

Browser Support For Tag <Base>

 Internet Explorer  Firefox  Opera  Google Chrome  Safari


0 comments :

Post a Comment