Posted By

Nettuts on 10/24/10


Tagged


Versions (?)

Who likes this?

6 people have marked this snippet as a favorite

raspo
mikeerickson
barbietunnie
f1r3fl3x
qubestream
leobetosouza


Anchor Href is Local?


 / Published in: JavaScript
 

  1. // If href does not contain "http" at the beginning, or it's an absolute, but local href, must be local.
  2. var isLocal = ( !/^(http)/.test(href) ) || ( href.indexOf(location.hostname) > -1 );

Report this snippet  

You need to login to post a comment.