+ 1
Difference between "document.baseURI", "window.location.hostname", and "document.documentURI"?
www.w3schools.com/js/js_window_location.asp The window.location object can be used to get the current page address (URL) and to redirect the browser to a new page The window.location object can be written without the window prefix window.location.hostname returns the domain name of the web host The window.location.hostname property returns the name of the internet host (of the current page) document.baseURI Returns the absolute base URI of the document document.documentURI Returns the URI of the document
3 RĂ©ponses
+ 4
đč window.location is a JavaScript object that tells you where you are on a webpage and can be used to take you to another webpage.
For example, if you want to redirect the user to another page, you can use window.location.href = "https://www.example.com";.
đč window.location.hostname tells you the name of the website you are on.
For example, if you are on the website âhttps://www.example.comâ,
window.location.hostname would
return âwww.example.comâ.
đč document.baseURI and document.documentURI tell you where on that website you are.
For example, if you are on the page
âhttps://www.example.com/about.htmlâ
document.baseURI would return âhttps://www.example.com/â
and document.documentURI would
return âhttps://www.example.com/about.htmlâ.
+ 4
Anytime đ.
Yes, perhaps they have a valid reason. In any case, I wish you the best of luck and great success.
+ 2
Moree thank you, w3schools didn't explain the differences that well