我在连接到google drive API时在我的localhost上收到此控制台错误,但我在脚本中配置的选择器成功显示了我的驱动器内容:
无法在'DOMWindow'上执行'postMessage':提供的目标来源(' https://docs.google.com ')与收件人窗口的来源(' http:// localhost:8000 ')不匹配.
加载" https://docs.google.com/picker?protocol=gadgets&origin=http%3A%2F%2Flocalho ... 2photos%22))&rpctoken = yxxydsx40r21&rpcService = 2dngvfb4tj9x&thirdParty = true" 时遇到无效的"X-Frame-Options"标题:'ALLOW-FROM http:// localhost:8000 '不是公认的指令.标题将被忽略.
我是否会忽略这一点,还是会给我带来麻烦?
我在heroku有一个游戏,现在我试图让它在Facebook画布上工作,但是,虽然它适用于Firefox,但在Chrome和IE中却没有.
IE显示带有按钮的警告,单击按钮时,它会显示内容.
在chrome中,我收到此错误:
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://game.herokuapp.com') does not match the recipient window's origin ('null').
Run Code Online (Sandbox Code Playgroud)
怎么了?
YouTube是否已开始锁定跨源请求?
我在我的网站上使用全屏自动播放英雄视频,它已经运行了很长时间.在过去的几周内它停止工作,我在日志中有以下错误.
无法在'DOMWindow'上执行'postMessage':提供的目标来源(' https://www.youtube.com ')与收件人窗口的来源(' https://tbrogames.github.io ')不匹配.
根据这个问题的答案
我尝试在http和https之间更改主机以查看是否会修复它而它没有.
我的网站抛出错误:https://tbrogames.github.io/
我找到了一个更大的游戏网站也有这个问题. https://playbattlegrounds.com/main.pu
他们还使用youtube视频作为英雄/启动视频; 并且它不再起作用,抛出相同的错误.
相关的JavaScript可以在这里找到 https://github.com/tbrogames/tbrogames.github.io/blob/master/js/defer.js
但是,这工作了很长时间,我没有改变任何代码.这就是为什么我认为这是YouTube所做的改变.
我在我的角度应用程序中集成了Stripe付款模块。当我运行该应用程序时,它显示以下错误。
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://js.stripe.com') does not match the recipient window's origin ('http://localhost:4200').
有什么解决办法吗?
我正在尝试在打开模态时启动youtube视频,直到完成后才进入下一页.
我的下面的脚本适用于Chrome,但在Firefox和Edge中会产生此错误.
无法在'DOMWindow'上执行'postMessage':提供的目标源(' https://www.youtube.com ')与收件人窗口的原点(' http://example.com ')不匹配.
使用Javascript
<script src="http://www.youtube.com/player_api"></script>
<script>
// autoplay video
function onPlayerReady(event) {
event.target.playVideo();
}
// when video ends
function onPlayerStateChange(event) {
if(event.data === 0) {
alert('Thank you for watching - Click OK to see your results');
}
}
</script>
<script language="JavaScript">
$(document).ready(function() {
$('#post_form').submit(function() { // catch the form's submit event
$("#adModal").modal("show");
var time = $('#adtime').val();
//startCountdownTimer(time) ;
// create youtube player
var player;
player = new YT.Player('player', {
width: '640',
height: '390',
videoId: 'EF-jwIv1w68', …Run Code Online (Sandbox Code Playgroud) 完整的错误是“无法在'DOMWindow'上执行'postMessage':提供的目标来源(' https://www.youtube.com ')与收件人窗口的来源(' http:// localhost:8100 ' )。”,这就是我在index.html文件中所做的事情,音频来了,视频却没有。
<script>
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
// Replace the 'ytplayer' element with an <iframe> and
// YouTube player after the API code downloads.
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player('ytplayer', {
height: '390',
width: '640',
videoId: 'jdqsiFw74Jk'
});
}
</script>
Run Code Online (Sandbox Code Playgroud)
我也想将视频ID从页面发送到index.html
无法在“DOMWindow”上执行“postMessage”:提供的目标源(“ https://www.youtube.com ”)与收件人窗口的源(“ https://my-site.ru ”)不匹配。
Nginx 在服务器上。当然还有 https!
但我收到了这个错误...并且只有在 Google Chrome 中视频无法启动,Firefox 显示一切正常(和 Edge)!
我收到此错误: 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
youtube ×5
javascript ×4
youtube-api ×3
angular ×1
facebook ×1
google-api ×1
heroku ×1
ionic2 ×1