Skip to content

Instantly share code, notes, and snippets.

@BinaryMuse
Created August 26, 2010 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BinaryMuse/552330 to your computer and use it in GitHub Desktop.
Save BinaryMuse/552330 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Test Page</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
<p>Pretend the domain is http://binarymuse.net/.</p>
<p><a href="http://google.com/">Go to Google</a></p>
<p><a href="http://www.binarymuse.net/contact">Contact BinaryMuse</a></p>
<p><a href="http://binarymuse.net/faq" target="_blank">BinaryMuse's FAQ</a></p>
<p><a href="http://jquery.com">jQuery Rocks!</a></p>
<script>
$.expr[':'].external = function(obj) {
return !(obj.hostname == "binarymuse.net" || obj.hostname == "www.binarymuse.net")
}
$("a:external").each(function(index, Element) {
Element.target = "blank";
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment