Anchor hyper reference in html have different attributes, one of them is target where we target different destinations to show our link. Suppose we have a link <a href=”http://www.google.com/”>Google</a> We want this link to open page in new tab how will we do that? To open this link in new tab we will use target=”_blank” that’s it.
Top open page in new tab we use <a href=”http://www.google.com/” target=”_blank”>Google</a> Target blank attribute is the code which open this link in new empty tab.
There are different targets for href as well.
HTML open page in new window
As we know how to open a page in new tab we have one more property of target attribute. That property is _new that is same as like _blank so if you want to html open page in new window follow <a href=”http://www.google.com/” target=”_blank”>Google In New Window!</a> this _new attribute help you opening link in new window.
HTML open page in parent
If you are making a link to a page which page you are displaying in iframe inside a html page then maybe sometime you need to open your new page or at least one link in parent window. When we create iframe in html document and loads another page inside that iframe then that page becomes child of page which contain that iframe so we use <a href=”http://www.google.com/” target=”_parent”>Google in parent</a>.
by default links reference to self means they open everything over to the page visitor is currently inn. By target blank we want visitor to stay on our page, by new window we want user to visit new window, and different things.
When you should open html page in new tab?
Actually we do not have much power to interfere user’s computer via powerful language JavaScript even cause users have their privacy and websites are not allowed to play with them. Opening new tabs again and again on each link click looks like ethical? No its not ethical and mostly users will just hate you and will ignore your site permanently.
Be wise and honest with yourself while using target blank or opening pages in new tabs. The links to your site’s other pages should never open in new tab they should point to same window or tab user is in , but when you have external links to other sites like google, bing etc you can link them to open in new tab that’s it. Remember always make a website so you like that site first as a user.