In JavaScript programming, location.reload is often used to refresh the page.
Example:
window.location.href=window.location.href; window.location.reload;
After testing, these two sentences can replace location.reload(true);
in some cases without a retry dialog box to achieve the refresh effect
How to refresh the page in js There are many kinds. There is a location.reload() function in js, which can achieve the function we want.
window.location.reload(true) //The browser re-requests resources from the server and does not include cache tags in the http request header.
Example 1, refresh the current page
Example 2, JS implementation of refreshing iframe method
Use the name attribute of iframe to position
或
Example 3, first, define an iframe
aa.htm page content:
function aa() { (php中文网 m.sbmmt.com 编辑整理) //parent.location.replace(parent.location.href);//服务器端重新创建页面 parent.document.location.reload();//相当于F5 //window.location.href(parent.location.href);//iframe内容重定向 }
Note:
window.location.reload;
If you submit data during refresh, a dialog box will appear!
Solution:
window.location.href=window.location.href; window.location.reload;
Refresh the parent window:
window.opener.location.href=window.opener.location.href; window.opener.location.reload();
For more js refresh page location.reload() usage related articles, please pay attention to PHP Chinese website!