前提・実現したいこと
YouTube Data APIについてエラーを解決したく質問です。
github.com/youtube/api-samples/javascript/search.html
上記のhtmlファイルをブラウザで開いて、動画の検索をしたいと思っています。
以下の手順を行うとエラーが発生しました。
- Google Cloud ConsoleにてYouTube Data APIを有効にする。
- 「APIとサービス」の「認証情報を作成」から「OAuthクライアントID」を選択してクライアントIDを取得。
- auth.jsのOAUTH2_CLIENT_IDにクライアントIDを設定。
- search.htmlの
//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
をhttps://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
に変更。 - Safariでsearch.htmlを起動。
発生している問題・エラーメッセージ
[Error] The source list for Content Security Policy directive 'script-src' contains an invalid source: ''strict-dynamic''. It will be ignored. [Error] Unable to post message to file://. Recipient has origin null.
該当のソースコード
[Error] Unable to post message to file://. Recipient has origin null. postMessage (anonymous関数) (cb=gapi.loaded_0:99:466)
試したこと
search.htmlに<script src="https://www.youtube.com/iframe_api"></script>
を記述。
- Chrome、Firefoxで確認。
補足情報(FW/ツールのバージョンなど)
Darwin Kernel Version 17.5.0: Fri Apr 13 19:32:32 PDT 2018; root:xnu-4570.51.2~1/RELEASE_X86_64
Safari バージョン11.1 (13605.1.33.1.4)
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。