$('a').each(function() {var a = new RegExp('/' + window.location.host + '/');if(!a.test(this.href)) {$(this).click(function(event) {event.preventDefault();event.stopPropagation();window.open(this.href, '_blank');});}});
My depot
I Write about anything regarding the internet. Freebies and other stuff.
söndag 27 februari 2011
Code Snippet: Open External Links In New Window
You can do this straight with HTML, but that is invalid markup, this takes care of business without invalid code and unnecessary markup.
Code snippet: Find all Internal Links
Find all links that start with the sites domain, a slash, relative file path, or a hashtag.
var siteURL = "http://" + top.location.host.toString();var $internalLinks = $("a[href^='"+siteURL+"'], a[href^='/'], a[href^='./'], a[href^='../'], a[href^='#']");
My Depot
Welcome to my depot. here i will put something about anything. I will write down all things i can about anything.
It can be code snippets and otherstuff
It can be code snippets and otherstuff
Prenumerera på:
Inlägg (Atom)