[英]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, 我的JavaScript函数在Firefox中运行正常,但在Google-Chrome和其他Webkit浏览器中却无法正常运行,并在控制台中出现以下错误,
"Unsafe JavaScript attempt to access frame with URL 'x' from frame with URL 'y'. Domains, protocols and ports must match."
“不安全的JavaScript尝试从具有URL'y'的框架访问具有URL'x'的框架。域,协议和端口必须匹配。”
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
domain.com
与www.domain.com
不同
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.