无法在“DOMWindow"上执行“postMessage":https://www.youtube.com !== http://localhost:9000 [英] Failed to execute 'postMessage' on 'DOMWindow': https://www.youtube.com !== http://localhost:9000

查看:49
本文介绍了无法在“DOMWindow"上执行“postMessage":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.comcode>,但没有像我的那样目标是 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.

  1. 我不明白这个问题.有什么问题?
  2. 我该如何解决?

推荐答案

我认为这是目标源为 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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆