Code Premix

window.location.origin

📅July 25, 2021|🗁#quick Knowledge BaseJavaScript

The window.location read-only property returns a location object with information about the current location of the document.

Example: window.location.href

This method returns the origin of the current location, composed of protocol, host & port (if exists).

console.log(window.location.origin);

// Output: https://codepremix.com

That’s it in this #quick KB.
Thank you for reading. Happy Coding..!!