gpt4 book ai didi

javascript - Vimeo 视频可以在本地运行,但不能在实时网站上运行 : Uncaught Security Error: origin error with iframe

转载 作者:行者123 更新时间:2023-12-01 01:44:31 26 4
gpt4 key购买 nike

我很难弄清楚这个问题。我的网站上有两个视频,由 vimeo 托管。使用他们提供的嵌入代码,一个视频将显示并播放,另一个视频将在本地播放,但一旦我将其上传到 bluehost,则不再播放。

控制台显示:未捕获的安全错误:无法从“HTMLIFrameElement”读取“contentDocument”属性:阻止来源为“http://www.example.org”的框架访问来源为“http://example.org”的框架。协议(protocol)、域和端口必须匹配。

它引用了 jquery.min.js。

我发现了一些关于如何使用 document.domain 解决此问题的建议,但没有效果。任何帮助将非常感激。感谢您的宝贵时间

最佳答案

来自https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy

http://store.company.com/dir2/other.html : Success
http://store.company.com/dir/inner/another.html : Success
https://store.company.com/secure.html : Failure - Different protocol
http://store.company.com:81/dir/etc.html : Failure - Different port
http://news.company.com/dir/other.html : Failure - Different host

您想要查看的是底线 - '失败 - 不同的主机':

你的解释有http://example.comhttp://www.example.com,它们实际上可以被认为是不同的主机。所以我会尝试将 www 或非 www 都匹配。

如果这不起作用,另一个解决方案是使用 HTTP 访问控制 (CORS),但它可能比您愿意处理的复杂得多。 https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

关于javascript - Vimeo 视频可以在本地运行,但不能在实时网站上运行 : Uncaught Security Error: origin error with iframe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30082388/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com