If link does not contain "http" at the beginning, or it's an absolute, but local href, it must be local.
function isLocal(link) {
return (!(/^(http)/).test(link)) || (link.indexOf(location.hostname) > -1);
}
If link does not contain "http" at the beginning, or it's an absolute, but local href, it must be local.
function isLocal(link) {
return (!(/^(http)/).test(link)) || (link.indexOf(location.hostname) > -1);
}