Skip to content

XmlmXmlmX/noopener.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

noopener.js

Prevent phishing when use target="_blank". This JavaScript is self executed. It will find all <a>-Elements in your document and will set the rel-Attribute to "noopener noreferrer".

Installation

You can install it wih bower:

bower install noopener-js

Further, you can also install it via NPM:

npm install noopener-js --save

Or just like the oldschool, copy the source or better the minified file into your project.

Usage

Very straightforward when using NPM:

<script src="node_modules/noopener-js/dest/noopener.js" type="text/javascript"></script>

Or when using Bower:

<script src="bower_components/noopener-js/dest/noopener.js" type="text/javascript"></script>

Example

If your markup looks like this:

<a href="https://google.de/" target="_blank">Visit Google</a>

Noopener.js will change your markup to this:

<a href="https://google.de/" target="_blank" rel="noopener noreferrer">Visit Google</a>

Resources

To-Dos

  • Test
  • Update this readme!

About

Prevents phishing attacks when use target=blank

Resources

License

Stars

Watchers

Forks

Packages

No packages published