繁体   English   中英

window.location.replace无法正常工作

[英]window.location.replace is not working

function setInit(){
    iu.init({
        saveFile : 'store/saveImageFile'
        ,CallBackOnSave : function (s){
            console.log("redirect");
            window.location.replace("store/details");
        }
    });
}

iu是图像上传模块,没有问题。 实际上,我可以看到redirect的控制台日志。

问题是,重新加载了同一页面,而不是进入替换页面中的URL。

也尝试了其他方法,例如href ,同样的结果。

只需使用:

window.location.href = "store/details";

也许尝试:

parent.window.location.href = "store/details";

您可以通过这种方式使用

句法

window.location.href = window.location.host + relativePath 
window.location.href = relativePath

window.location.href = "store/details";
window.location.href = window.location.host + 'store/details';

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM