如何将 https://youtube.com 做成 iframe 而不是视频而是 youtube 本身
How to do https://youtube.com into an Iframe NOT a video but youtube itself
我正在尝试将 YouTube 放入我的 HTML5 网站。我正在使用 iframe 来执行此操作,但我 不想 只想将视频放入其中,我想将 YouTube 本身放入其中。我希望能够在该 iframe 中搜索和观看视频。使用 Google 你可以做到,
<iframe src="https://www.google.com/search?igu=1" width="65%" height="60%" ></iframe>
它将允许您在 iframe 中访问 Google。我想这样做,但要使用 YouTube。
我已经尝试研究过这个,但每个人都只是问如何制作视频。我试过了,
https://www.youtube.com/results?search_query=
但这也不起作用。
<iframe src="https://www.youtube.com/" height="60%" width="65%" ></iframe>
这是我希望 YouTube iframe 具有的宽度和高度。你会注意到它被拒绝了。
如果您检查带有 iframe 的页面上的网络控制台,您会看到 YouTube 的 header 'X-Frame-Options' 设置为 'sameorigin',这将不允许您使用它位于 third-party 网站的 iFrame 中。
完整消息:
Refused to display 'https://www.youtube.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
我正在尝试将 YouTube 放入我的 HTML5 网站。我正在使用 iframe 来执行此操作,但我 不想 只想将视频放入其中,我想将 YouTube 本身放入其中。我希望能够在该 iframe 中搜索和观看视频。使用 Google 你可以做到,
<iframe src="https://www.google.com/search?igu=1" width="65%" height="60%" ></iframe>
它将允许您在 iframe 中访问 Google。我想这样做,但要使用 YouTube。
我已经尝试研究过这个,但每个人都只是问如何制作视频。我试过了,
https://www.youtube.com/results?search_query=
但这也不起作用。
<iframe src="https://www.youtube.com/" height="60%" width="65%" ></iframe>
这是我希望 YouTube iframe 具有的宽度和高度。你会注意到它被拒绝了。
如果您检查带有 iframe 的页面上的网络控制台,您会看到 YouTube 的 header 'X-Frame-Options' 设置为 'sameorigin',这将不允许您使用它位于 third-party 网站的 iFrame 中。
完整消息:
Refused to display 'https://www.youtube.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.