Posted By

cherrywaves on 09/03/09


Tagged

links external mootools


Versions (?)

XHTML valid external links with mootools


 / Published in: JavaScript
 

URL: http://www.kd3sign.co.uk/blog/post/xhtml-valid-external-links-with-mootools.html

  1. $$('a[href^=http]').each(function(a) {
  2. if (window.location.hostname) {
  3. var hostname = window.location.hostname.replace("www.", "").toLowerCase();
  4. if (!a.get('href').contains(hostname)) {
  5. a.set({
  6. 'target': '_blank'
  7. });
  8. }
  9. }
  10. });

Report this snippet  

You need to login to post a comment.