Home >Web Front-end >JS Tutorial >Several ways to refresh the page using JS

Several ways to refresh the page using JS

高洛峰
高洛峰Original
2016-12-17 15:14:322153browse

Several ways to refresh the page in Javascript:

1 history.go(0)

2 location.reload()

3 location=location

4 location.assign(location)

5 document.execCommand('Refresh ')

6 window.navigate(location)

7 location.replace(location)

8 document.URL=location.href.

______________________________________________

In the frame page: (One of the subpages in the frame page)

top.location.reload(); Refresh the entire page
self.location.reload(); Refresh this page

window.parent.location.href='' Frame page redirect

____________________________________________

How to automatically refresh the page :1. Automatically refresh the page: Add the following code to the area where 20 means refreshing the page every 20 seconds. Refresh when the window is opened Refresh when the window is closed.成功 Example: After the data is added, the dialog box pops up and refreshes the page

(infoAction_sort.Insert (info_sort)) {

scriptManager.registerStartupscript (this.UpdatePanel, this.Gettype (), "Al ErT "," Alert (' Album category added successfully');window.location.reload();", true);

                                                    ing()); //Refresh this page
                                                                          



For more related articles on JS methods to refresh the page, please pay attention to PHP Chinese net!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Json format analysisNext article:Json format analysis