=====javascript中弹出提示框跳转到其他页面=====
window.location="";和 location.replace("");有什么区别?这两个都能让网页导向令一个网址,那么有什么区别呢?比如能带参数,不能带参数之类的. Replace?还是Reload()?现在,我在b.html页面中用window.location.replace("c.html");与用window.location.href("c.html");分别进入c.html页面.从用户界面来看是没有什么区别的,但是现在c.html页面有一个“返回”按钮,用window.location.href("c.html");进入c.html页面时,c.html页面中的调用window.history.go(-1);wondow.history.back();进入c.html页面时,一点这个"返回"按钮就要返回b.html页面的话,而如果用window.location.replace("c.html");进入c.html页面的话,c.html页面中的调用window.history.go(-1);wondow.history.back();方法是不好用的,会返回到a.html. 因为window.location.replace("c.html");是不会向服务器发送请求而进行跳转,而window.history.go(-1);wondow.history.back();方法是根据服务器记录的请求决定该跳到哪个页面的,所以会跳到系统默认页面a.html 。
var url = "http://www.baidu.com";
window.open(url); //打开新窗口跳转
window.self.location = url; //当前窗口跳转