Explaining the usage of JavaScript’s document.location.
document.location allows you to get the current page’s URL or change the URL.
Using the origin method saves you the trouble of URL regex replacement.
document.location.href
"https://tpc.googlesyndication.com/safeframe/1-0-9/html/container.html"
document.location.origin
"https://tpc.googlesyndication.com"
document.location.pathname
"/safeframe/1-0-9/html/container.html"
document.location.host
"tpc.googlesyndication.com"
document.location.protocol
"https:"