code: function isLocal(url) {
          var loc = document.location,
              reg = new RegExp("^\\.|^\/(?!\/)|^[\\w]((?!://).)*$|" + loc.protocol + "//" + loc.host);
          return url.match(reg);
        }
docs: helper method to assert if a given url is local