11/24/2023 0 Comments Direct url to new windowYou have to think carefully about when it would be a good time to use the target="_blank" attribute. In a lot of cases, you do not want to change this default behavior because users have grown to expect this. When users click on a link, the default behavior is to have that link open on the current page they are on without opening a new browser tab. Should You Use the target="_blank" Attribute All the Time? As you can see in this Can I use table, the noopener keyword is supported by most browsers except for Internet Explorer 11.Įven with this update, a lot of developers will still use rel=noopener for links using the target=_blank attribute. In 2021, there was an update made where modern browsers now set rel=noopener to any link using the target=_blank attribute. If you want to learn more about the security concerns that rel=noopener helped solve, then please read through this helpful article. Here is how the noopener keyword is used: DevDocs documentation You can use the noopener keyword as a way to help prevent that security issue from happening. If the malicious user gained access to your window object then they could redirect your page to a malicious URL. The noopener keyword in the rel attribute is used primarily for security reasons to prevent malicious users from messing with the original web page through the Window.opener property. If I were to omit the target="_blank" attribute, then the default behavior would be to leave the current web page and go directly to the link without opening a new browser tab. When you click on the freeCodeCamp link, then it will open up a new browser tab for you. To learn how to code for free, please visit In this example, I have nested a link inside a set of paragraph tags to direct people to freeCodeCamp. When the user clicks on the link, a new browser tab will automatically open to that page. The target="_blank" attribute is used inside the opening anchor tag like this: How to Open Up a New Browser Tab Using target="_blank" I will also talk about when you should consider using this attribute. In this article, I will show you how to use the target="_blank" attribute through code examples. There will be times where you will want your user to click on a website link and have it open in a new browser tab.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |