简体   繁体   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 is an image upload module which has no issues. iu是图像上传模块,没有问题。 In fact I can see the console log of redirect . 实际上,我可以看到redirect的控制台日志。

problem is, the same page gets reloaded, instead of going to the url in replace. 问题是,重新加载了同一页面,而不是进入替换页面中的URL。

tried other ways like href as well, sadly the same result. 也尝试了其他方法,例如href ,同样的结果。

只需使用:

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

也许尝试:

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

You can use by this way, 您可以通过这种方式使用

Syntax 句法

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

example

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