Warm tip: This article is reproduced from serverfault.com, please click

javascript-无法在“ DOMWindow”上执行“ postMessage”:https://www.youtube.com!== http:// localhost:9000

(javascript - Failed to execute 'postMessage' on 'DOMWindow': https://www.youtube.com !== http://localhost:9000)

发布于 2014-12-19 19:53:18

这是我收到的错误消息:

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').

我还看到了其他类似的问题,其中目标的原点是http://www.youtube.com和接收者的原点是https://www.youtube.com,而我的目标https://www.youtube.com目标的原点是http://localhost:9000

  1. 我没问题。问题是什么?
  2. 我该如何解决?
Questioner
Adam Zerner
Viewed
0
7,862 2019-08-15 12:44:52

我认为这与目标来源有关https我怀疑是因为你使用的是iFrame网址,http而不是https尝试更改要嵌入为的文件的url https

例如:

'//www.youtube.com/embed/' + id + '?showinfo=0&enablejsapi=1&origin=http://localhost:9000';

成为:

'https://www.youtube.com/embed/' + id + '?showinfo=0&enablejsapi=1&origin=http://localhost:9000';