2

I am writing an HTML-only app and want to embed a YouTube IFRAME-based player. I used the demo code from https://developers.google.com/youtube/iframe_api_reference unfortunately, this does not seem to work out-of-the-box for HTML files loaded via the file:// protocol. I get the following error:

www-widgetapi.js:100

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('file://') does not match the recipient window's origin ('null').

I found Failed to execute 'postMessage' on 'DOMWindow': https://www.youtube.com !== http://localhost:9000 unfortunately it didn't help: whether I include it using their JS file via http or https doesn't matter.

Community
  • 1
  • 1
D.R.
  • 18,900
  • 20
  • 82
  • 181

2 Answers2

0

The problem here is, you are running it through your file system. Instead try using local host.

For more information read this

Community
  • 1
  • 1
Techidiot
  • 1,891
  • 1
  • 14
  • 28
  • I've found that as well ... thing is, I don't want to run a local web server. The app should be HTML only. – D.R. Oct 01 '16 at 18:49
0

If you do not use your own IFRAME but instead let the YouTube API create the IFRAME -> no problems whatsoever. Don't know why though, so if anyone is able to elaborate I'd be interested.

D.R.
  • 18,900
  • 20
  • 82
  • 181