code: function sameOrigin(url) {
    let origin = `${location.protocol}//${location.hostname}`;
  
    if (location.port) {
      origin += `:${location.port}`;
    }
    return url && url.indexOf(origin) === 0;
  }
docs: Check if 'url' is from same origin
  @param {String} url
  @returns {Boolean}