简体   繁体   中英

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. In fact I can see the console log of redirect .

problem is, the same page gets reloaded, instead of going to the url in replace.

tried other ways like href as well, sadly the same result.

只需使用:

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';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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