2

我有一个 HTML 页面,我在其中嵌入了一个带有以下代码的 youtube 视频:

<iframe width="600" 
     height="338" 
     src="http://www.youtube-nocookie.com/embed/aUHdhfghhahlY?autohide=1&amp;theme=light&loop=1&playlist=edkAiJxQWHQ&amp;hd=1&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0&amp;wmode=transparent&amp;autoplay=1" >
</iframe>

视频运行良好,但我在控制台中收到以下错误。

Blocked a frame with origin "https://www.youtube-nocookie.com" from accessing a frame with origin "http://www.domain.com".  The frame requesting access has a protocol of "https", the frame being accessed has a protocol of "http". Protocols must match.

未捕获的错误:在 NPObject 上调用方法时出错。

我怎样才能避免这个错误?

4

1 回答 1

1

“youtube-nocookie.com”将 HTTP 请求重定向到 HTTPS,但使用页面内部的不安全源。因此,如果您无法访问“youtube-nocookie.com”的来源,您将无能为力。如果有,请仅使用 HTTPS 源或阻止重定向到 HTTPS。

于 2013-09-04T00:35:56.560 回答