无法在“DOMWindow"上执行“postMessage":https://www.youtube.com !== http://localhost:9000 [英] Failed to execute 'postMessage' on 'DOMWindow': https://www.youtube.com !== http://localhost:9000
问题描述
这是我收到的错误消息:
This is the error message that I get:
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
code>,但没有像我的那样目标是 https://www.youtube.com
并且来源是 http://localhost:9000
.
I've seen other similar problems where the target origin is http://www.youtube.com
and the recipient origin is https://www.youtube.com
, but none like mine where the target is https://www.youtube.com
and the origin is http://localhost:9000
.
- 我不明白这个问题.有什么问题?
- 我该如何解决?
推荐答案
我认为这是目标源为 https
的问题.我怀疑这是因为您的 iFrame url 使用的是 http
而不是 https
.尝试将您尝试嵌入的文件的 url 更改为 https
.
I believe this is an issue with the target origin being https
. I suspect it is because your iFrame url is using http
instead of https
. Try changing the url of the file you are trying to embed to be 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';
这篇关于无法在“DOMWindow"上执行“postMessage":https://www.youtube.com !== http://localhost:9000的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!