Home > Web Front-end > JS Tutorial > js location.replace与location.reload的区别_javascript技巧

js location.replace与location.reload的区别_javascript技巧

WBOY
Release: 2016-05-16 18:20:01
Original
1557 people have browsed it

location.reload相当于我们按F5,页面在服务器端已经存在,isPostBack页面不会从服务器端重新生成,然后返回客户端

会在浏览器的历史浏览记录中增加一条记录

location.replace 页面会从服务器端重新创建,not ispostback,这个是用新的url代替原Url,把Histrory里面url也替换成了新的Url

window.location.href,本层页面跳转

首先,定义一个iframe

复制代码 代码如下:



aa.htm内容如下:
复制代码 代码如下:


function aa() {
//parent.location.replace(parent.location.href);//服务器端重新创建页面
parent.document.location.reload();//相当于F5
//window.location.href(parent.location.href);//iframe内容重定向
}
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template