【问题标题】:Uncaught Error: Error calling method on NPObject Error with embedded Youtube Video未捕获的错误:在嵌入 Youtube 视频的 NPObject 错误上调用方法时出错
【发布时间】:2013-09-04 00:11:55
【问题描述】:

我有一个 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 上调用方法时出错。

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

【问题讨论】:

    标签: javascript html youtube


    【解决方案1】:

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

    【讨论】:

    • 如何防止重定向?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多