Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
June 18, 2021 06:08 am GMT

HTML target=_blank vs target=blank

Earlier I thought they both perform the same actions like opening a link to a new tab (or window ) in the browser. But, just removing the underscore can make an important difference.

The target attribute specifies where to open the linked document.

Example

<a href="https://www.google.com" target="_blank">Visit google Site</a>

With target=_blank,

Whenever we click the link, it will open in a new tab. So, let's say if we click more links then, every time a new browser tab will open which can create multiple tabs, and maybe it can frustrate the user and its experience.

target _blank example

Alternate solutions we can use target=blank,

Now, let's remove the underscore, then the browser will open the link in a tab called 'blank' instead of opening a new one. With this, if the user will click multiple links then the links will open in a single tab.

Example

<a href="https://www.google.com" target="blank">Visit google Site</a>

target blank example

Demo

Conclusion
By coming this far I hope you can implement this awesome target attribute trick on your project. So, I suggest you give it a try on your project and enjoy it!

Feel free to share your thoughts and opinions and leave me a comment if you have any problems or questions.

Till then,
Keep on Hacking, Cheers


Original Link: https://dev.to/integridsolutions/html-target-blank-vs-target-blank-5b7m

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To