这是我得到的错误消息:
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided
('https://www.youtube.com') does not match the recipient window's origin
('http://localhost:9000').
Run Code Online (Sandbox Code Playgroud)
我已经看到了目标来源http://www.youtube.com和收件人来源的其他类似问题https://www.youtube.com,但没有一个像我的目标所在的地方https://www.youtube.com和原点http://localhost:9000.
我收到此错误: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('<URL>') does not match the recipient window's origin ('<URL>').
我的页面按我希望的方式运行(我没有注意到任何不受欢迎的行为),但我从不喜欢忽略控制台中的错误,尤其是在我什至不了解根本原因的情况下。
我的问题不是重复的,因为我已经研究了所有这些问题,但没有一个答案有效:
我已经在用了https。
我已经尝试设置playerVars为{origin: window.location.origin}.
我已经尝试过设置host。
我已经尝试过更改 iframe 的可见性。
等等。
var playerVars = {origin: window.location.origin};///sf/answers/3536277321/
window.onYouTubeIframeAPIReady = function () {
for (var i = 0; i < youtube.length; i++) …Run Code Online (Sandbox Code Playgroud) youtube youtube-api youtube-javascript-api youtube-iframe-api