Resources

Location

window.location

This object can be used to get the current page URL or load page.

  • window.location.href - get or set the current page URL.
  • window.location.protocol - get the web protocol used - http: or https:.
  • window.location.hostname - get domain name.
  • window.location.pathname - get the path and filename of the current page.
  • window.location.port - get the port number.
  • window.location.assign() - load a new document.