An Interest In:
Web News this Week
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
- March 26, 2024
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.
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>
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
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To