我正在寫一個僅限HTML的應用程序,並希望嵌入一個基於YouTube IFRAME的播放器。不幸的是,我使用了https://developers.google.com/youtube/iframe_api_reference的演示代碼,這對於通過file://協議加載的HTML文件來說似乎不起作用。我得到以下錯誤:如何在localhost html文件中使用YouTube IFRAME-Player?
www-widgetapi.js:100
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('file://') does not match the recipient window's origin ('null').
我發現Failed to execute 'postMessage' on 'DOMWindow': https://www.youtube.com !== http://localhost:9000遺憾的是它並沒有幫助:我是否包括它使用自己的JS文件通過HTTP或HTTPS無所謂。
我發現,以及...事情是,我不想運行本地Web服務器。該應用程序應該只是HTML。 –