У меня есть IFRAME:Не удалось выполнить 'PostMessage' на 'Окно': Invalid целевой происхождения
<iframe id="GameFrame"
sandbox="allow-scripts allow-pointer-lock"
src="https://127.0.0.1:112/games/1047/play">
</iframe>
Мой родительская страница находится по адресу:
https://127.0.0.1/arcade/not-hidden/space-blaster-1047
Я пытаюсь оставить сообщение в плавающем фрейме:
var gameIframe = $("#GameFrame");
gameIframe.get(0).contentWindow.postMessage("screenshot", "");
Но это бросает ошибку:
Uncaught SyntaxError: Failed to execute 'postMessage' on 'Window': Invalid target origin '' in a call to 'postMessage'.
Другие попытки:
postMessage("screenshot", "https://127.0.0.1");
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided (' https://127.0.0.1 ') does not match the recipient window's origin ('null').
Как я могу получить это опубликовать сообщение в плавающем фрейме?
Это выглядит как дубликат. Смотрите: http://stackoverflow.com/questions/23373376/uncaught-syntaxerror-failed-to-execute-postmessage-on-window-invalid-targe – theUtherSide