reload、replace、href、assign、window.history.go(0)的区别

reload、replace、href、assign、go(0)在做刷新使用时:

window.location.reload(); 

window.location.replace(location.href);

window.location.href=location.href;(注释:location.href可以用于显示,也可用于等于window.location.href="xxx")

window.history.go(0);

window.location.assign(location.href);

reload,go(0)依然可以有$_GET、$_POST的值,replace、href、assign则不行; 

////////////////////////////////////////////////////////////////////////// 

 replace、href、assign、在做跳转到另一页面A使用时:

replace:A会覆盖当前页的历史记录,在A页面若使用键盘back键时,A会直接回转到上上一个页面;

href、assign:不会覆盖当前页的历史记录,在A页面使用backj键时,A会回转到上一个页面,并且还保留get/post的值;

window.location.assign("xxx")=(window.location.href='xxx' )

 

posted @ 2016-04-06 11:06  夜深人静123  阅读(906)  评论(0编辑  收藏  举报