Youtube嵌入:不安全的JavaScript尝试访问框架 [英] Youtube embed: Unsafe JavaScript attempt to access frame

查看:342
本文介绍了Youtube嵌入:不安全的JavaScript尝试访问框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Wicket应用程序,其中包含一个包含嵌入式Youtube视频的页面。视频嵌入并播放正常,但显然它会导致页面的其余部分无法呈现 - 似乎在嵌入后的DOM元素根本不显示在页面上,尽管它在标记。

We have a Wicket app with a page that includes an embedded Youtube video. The video embeds and plays fine, but apparently it causes the rest of the page to not render- it seems that the DOM elements coming after the embed simply don't show up on the page, despite being in the markup.

查看Chrome中的错误控制台显示:

Looking at the error console in Chrome reveals:


不安全JavaScript尝试使用网址
访问
框架 http:/ /example.com/detail/COMMUNICATION/search/com-sonyericsson-hanashi
来自框架,网址为
http://www.youtube.com/embed/eJY7_De5opI?enablejsapi=1&autohide=1&showinfo=1
域名,协议和端口必须
匹配。

Unsafe JavaScript attempt to access frame with URL http://example.com/detail/COMMUNICATION/search/com-sonyericsson-hanashi from frame with URL http://www.youtube.com/embed/eJY7_De5opI?enablejsapi=1&autohide=1&showinfo=1. Domains, protocols and ports must match.

我用Google搜索了相当数量的人,好像在说它是无害的并忽略它。这似乎是错的,在我们的例子中,它实际上打破了页面。

I've googled this a fair amount, and people seem to be saying that it's innocuous and to ignore it. That just seems wrong, and in our case it actually breaks the page.

如果我们更改我们的应用程序以便通过ajax回调动态嵌入视频(用户单击Wicket AjaxLink),我们仍然会在控制台中收到错误,但至少页面完全呈现。不幸的是,这对我们无效,因为我们需要在用户首次点击页面时默认加载视频。

If we change our app so that the video is embedded dynamically via an ajax callback (user clicks a Wicket AjaxLink) we still get the error in the console, but at least the page renders fully. Unfortunately this won't work for us, as we need the video to be loaded by default when the user first hits the page.

修改 :我应该补充一点,虽然错误消息是从Chrome控制台获取的,但这个错误似乎影响了我尝试的每个浏览器:Chrome,Safari和Firefox。

Edit: I should add that although the error message was taken from the Chrome console, the bug seems to affect every browser I've tried: Chrome, Safari and Firefox.

推荐答案

安全错误不太可能破坏您的页面。看起来错误是在YouTube框架内发生的,这意味着在最坏的情况下,框架的内容会搞砸。

The security error is unlikely to break your page. It looks like the error is happening from within the YouTube frame, which means that in the worst case the content of the frame will be messed up.

框架/ iframe来自在任何情况下,外部页面都不能影响父文档的内容,除非它们来自相同的域和端口号。这是浏览器安全性的硬规则之一。

A frame/iframe from an external page cannot, under any circumstances effect the content of the parent document unless they are from the same domain and port number. It is one of the hard rules of browser security.

错误必须在您的标记中的其他位置。是否有机会看到一些示例标记?

The error must be elsewhere in your markup. Any chance of seeing some example markup?

[edit]

错误也可能出现在嵌入代码中标记。或者,如果任何脚本标签直接包含在页面上(而不是iframe中),它可能就在那里。

The error could also be in the embed code markup. Or, if any script tags are included directly on the page (not in the iframe) it could be there.

通常当这样的问题发生时,它是因为未关闭在某处标记,但它也可以是Javascript。

Usually when problems like this happens it is because of an unclosed tag somewhere but it could be Javascript as well.

这篇关于Youtube嵌入:不安全的JavaScript尝试访问框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆