不安全的 JavaScript 尝试使用 URL 访问框架
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7438020/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Unsafe JavaScript attempt to access frame with URL
提问by daryl
I've incorporated Vimeo into a WordPress theme I'm building, and I get these errors:
我已将 Vimeo 合并到我正在构建的 WordPress 主题中,但出现以下错误:
Unsafe JavaScript attempt to access frame with URL http://themes.ibrogram.com/beta/blog/from frame with URL http://player.vimeo.com/video/4749536. Domains, protocols and ports must match.
不安全的 JavaScript 尝试从 URL http://player.vimeo.com/video/4749536 的框架访问 URL http://themes.ibrogram.com/beta/blog/的框架 。域、协议和端口必须匹配。
Unsafe JavaScript attempt to access frame with URL http://themes.ibrogram.com/beta/blog/from frame with URL http://player.vimeo.com/video/28496744?title=0&byline=0&portrait=0. Domains, protocols and ports must match.
不安全的 JavaScript 尝试从 URL http://player.vimeo.com/video/28496744?title=0&byline=0&portrait=0 的框架访问 URL http://themes.ibrogram.com/beta/blog/的框架 。域、协议和端口必须匹配。
It also (I think) is the reason for the page still loading: http://themes.ibrogram.com/beta/blog/
这也是(我认为)页面仍在加载的原因:http: //themes.ibrogram.com/beta/blog/
回答by Marek Sebera
Read something about Javascript access security here:
在此处阅读有关 Javascript 访问安全性的内容:
- http://javascript.about.com/od/reference/a/frame3.htm
- Unsafe JavaScript attempt to access frame warning in Safari
- "Unsafe JavaScript attempt to access frame with URL..." error being continuously generated in Chrome webkit inspector
- http://blog.chromium.org/2008/12/security-in-depth-local-web-pages.html
- http://javascript.about.com/od/reference/a/frame3.htm
- 不安全的 JavaScript 尝试访问 Safari 中的帧警告
- Chrome webkit 检查器中不断生成“不安全的 JavaScript 尝试使用 URL 访问框架...”错误
- http://blog.chromium.org/2008/12/security-in-depth-local-web-pages.html
Specifically about implementing Vimeo and JavaScript unsafe access, I found this on a discussion on the Vimeo forums:
特别是关于实现 Vimeo 和 JavaScript 不安全访问,我在 Vimeo 论坛上的讨论中发现了这一点:
If you're using a webkit browser (Safari or Chrome) that error is actually coming from the Webkit Inspector trying to access the iframe (the Webkit Inspector is actually written in HTML and Javascript).
The thing to make sure is that you can't call any of the api or addEvent methods on the iframe until the player has finished loading. As per the example, you need to add the "onLoad" event first and then execute your code inside of that handler.
如果您使用的是 webkit 浏览器(Safari 或 Chrome),则该错误实际上来自尝试访问 iframe 的 Webkit Inspector(Webkit Inspector 实际上是用 HTML 和 Javascript 编写的)。
需要确保的是,在播放器完成加载之前,您不能在 iframe 上调用任何 api 或 addEvent 方法。根据示例,您需要先添加“onLoad”事件,然后在该处理程序中执行您的代码。
And second, I checked link you provided, and it loads fast and fine to me, so it is definitely not reason why you keep having this page loading long time
其次,我检查了你提供的链接,它加载速度很快而且对我来说很好,所以这绝对不是你让这个页面加载很长时间的原因