简体   繁体   中英

Javascript Function not working in webkit browsers

My JavaScript function is working perfectly in Firefox but in Google-Chrome and other webkit browsers it is not working properly and giving the following error in the console,

"Unsafe JavaScript attempt to access frame with URL 'x' from frame with URL 'y'. Domains, protocols and ports must match."

Following is the function code:

function xyz() {
    if (mainFrame.location.href === "x" || mainFrame.location.href === "y") {
        console.log('no');
    } else {
        mainFrame.location.replace("y");
    }
}

You can't access frames across domains as a security measure. Make sure that even the subdomains match. domain.com is different than www.domain.com

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