code: function resolveOriginRelativeURL (absolute, relative) {
    var origin;
  
    if (absolute) {
      // Get the origin from the absolute URL by joining the first 3 segments (e.g. "http", "", "example.com")
      origin = absolute.split('/').splice(0, 3).join('/');
    }
    else {
      // Use the current page's origin
      origin = location.origin || (location.protocol + location.host);
    }
  
    return origin + relative;
  }
docs: Resolves an origin-relative URL, such as "/file.json", "/dir/subdir/file.json", etc.
  
  @param {?string} absolute - The absolute URL to resolve against. Defaults to the current page URL.
  @param {string} relative - The relative URL to resolve
  @returns {string}