1
0
mirror of https://github.com/kirsle/kirsle.net synced 2024-12-23 15:39:29 +00:00
kirsle.net/www/designs/solar-bootstrap/offsite.js

21 lines
459 B
JavaScript
Raw Normal View History

2014-10-16 19:18:26 +00:00
/*
* Hyperlink Editor Script || Copyright 2014 Kirsle
*
* This script makes all offsite links open in a new window.
*/
$(document).ready(function() {
$("a").each(function() {
var $a = $(this);
var href = $a.attr("href");
if (href === undefined) {
return;
}
// Detect offsite links.
if (href.indexOf("http:") == 0 || href.indexOf("https:") == 0) {
$a.attr("target", "_blank");
}
});
});