+ 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 Respuestas
+ 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