Skip to content

Check whether a link dom node links to an 'external' website.

License

Notifications You must be signed in to change notification settings

foiseworth/external-link

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

External Link

npm version Build Status Coverage Status MIT Licensed

A simple function that tells you whether a link DOM node is 'external'.

A link is external if it:

  • has the attribute rel="external"
  • has the attribute target and the value is not _self
  • is an absolute link
  • is a telephone link
  • is a mailto link

To use

var external = require('external-link');
var link = document.querySelector('a');

external(link);

Versions

2.0.0 - changed handling of target so that any value other than _self will make it external

About

Check whether a link dom node links to an 'external' website.

Resources

License

Stars

Watchers

Forks

Packages

No packages published