Revision: 35678
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 12, 2010 00:12 by touffies
Initial Code
$.extend($.expr[':'],{ external: function(a,i,m) { if(!a.href) { return false; } return $(a).is('[rel*="external"]'); } }); $.fn.externalLinks = function() { return this.each( function() { $("a", this) .filter(function(){ if($(this).is(":external")){ return true; }else{ return $(this).is("[href^='http://']:not([href*='"+location.hostname+"'])"); } }) .unbind("click.external") .bind("click.external", function(){ return !window.open(this.href); }); }); };
Initial URL
Initial Description
Get all the links and check if there's a rel attribute external, if not, compare href to the current domain name.
Initial Title
Function ExternalLinks (Check the current domain)
Initial Tags
jquery
Initial Language
jQuery