会在浏览器的历史浏览记录中增加一条记录
location.replace 页面会从服务器端重新创建,not ispostback,这个是用新的url代替原Url,把Histrory里面url也替换成了新的Url
window.location.href,本层页面跳转
首先,定义一个iframe
实现代码如下:
<iframe method="post" id ="IFrameName" src="aa.htm" ></iframe>
aa.htm内容如下:
实现代码如下:
<input type ="button" value ="刷新" onclick ="aa()"/>
function aa() {
//parent.location.replace(parent.location.href);//服务器端重新创建页面
parent.document.location.reload();//相当于F5
//window.location.href(parent.location.href);//iframe内容重定向
}
以上就是【js location.replace与location.reload的区别】的全部内容了,欢迎留言评论进行交流!