function toAbsoluteURL(url) {
  const a = document.createElement('a');
  a.setAttribute('href', url); // <a href="hoge.html">
  // @ts-ignore
  return a.cloneNode(false).href; // -> "http://example.com/hoge.html"
}
function toAbsoluteURL(url) {
  const a = document.createElement('a');
  a.setAttribute('href', url); 
  
  return a.cloneNode(false).href; 
}
function toAbsoluteURL ( url ) { const a = document . createElement ( 'a' ) ; a . setAttribute ( 'href' , url ) ; // <a href="hoge.html"> // @ts-ignore return a . cloneNode ( false ) . href ; // -> "http://example.com/hoge.html" }
Changes a relative URL to an absolute URL.

@example
toAbsoluteURL('hoge.html') // http://example.com/hoge.html

@param {string} url Relative URL
@returns {string} Absolute URL
Changes a relative URL to an absolute URL .