Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
January 1, 2022 05:58 pm GMT

target="_blank" is a security risk?

As we all use target="_blank" to open the link into new tab of a window but everyone should know a risk inside it.

When we open a new tab link window.opener get triggered which made a limited access to the specific tab opened, for example; you can not go back in the previous page by clicking back button from your URL bar.

So what is the risk here?
when the new tab link open it can alter the Link page URL from window.opener.location.
If your external link is not trusty that may cause a real problem to your website.

What can happen?

  1. Hacker can redirect your domain.
  2. CSRF can be performed.
  3. XML entities can be altered.

How to prevent this?
Do not forget to add relation attribute in your link tag rel=noopener noreferrer

In a Nutshell <a href="https://thehassantahir.web.app" target="_blank" rel="noopener noreferrer">Thehassantahir</a>


Original Link: https://dev.to/thehassantahir/targetblank-is-a-security-risk-1ee4

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