Skip to main content

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);
}