Home >Web Front-end >JS Tutorial >What is the usage of window.location.href?
window.location
object can be used to obtain the current page address (URL) and redirect the browser to a new page.
The window.location object can be written without the window prefix.
window.location.href
##window.location.href property returns the URL of the current page.
window.location.href is often used for page jumps. It mainly has the following usages:
window.location.href=window.location.href and
window.location.reload() both refresh the current page. The difference lies in whether data is submitted. When data is submitted,
window.location.Reload() will prompt whether to submit it,
window.location.href=window.location.href; is to submit data to the specified url
self.location.href="url" location.href="url" window.location.href="url" this.location.href="url"2. Open the URL page on the parent page.
parent.location.href="url"3. Open the URL page on the top-level page.
top.location.href="url"Recommended tutorial:
The above is the detailed content of What is the usage of window.location.href?. For more information, please follow other related articles on the PHP Chinese website!