我有以下代碼來嵌入視頻。但它不起作用。 有什麼建議嗎?將視頻嵌入到iframe中?
<!DOCTYPE html>
<html>
<body>
<iframe src="https://vimeo.com/63534746"></iframe>
</body>
</html>
我有以下代碼來嵌入視頻。但它不起作用。 有什麼建議嗎?將視頻嵌入到iframe中?
<!DOCTYPE html>
<html>
<body>
<iframe src="https://vimeo.com/63534746"></iframe>
</body>
</html>
你回來在控制檯中的錯誤是Refused to display 'https://vimeo.com/63534746' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
這樣的Vimeo從做你正在嘗試做的阻止你。
有對X框,選擇三個可能的值:
DENY - 該頁無法在一個框架中顯示,無論網站試圖這樣做的。
SAMEORIGIN - 頁面只能以與頁面本身相同的原點顯示在框架中。
ALLOW-FROM uri - 頁面只能顯示在指定原點的框架中。
您可以使用Vimeo提供的嵌入代碼(點擊'Share'按鈕找到),而不是嵌入整個頁面。
<iframe src="https://player.vimeo.com/video/63534746?color=ffffff" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<p>
<a href="https://vimeo.com/63534746">Light Bikes</a> from <a href="https://vimeo.com/ericcorriel">Eric Corriel</a> on <a href="https://vimeo.com">Vimeo</a>.
</p>
您使用的鏈接指向視頻頁面,而不是視頻「嵌入」頁面。您可以使用該網站的「分享」功能,以獲得正確iframe
代碼:
針對特定的視頻,當你點擊分享按鈕中發現的嵌入代碼是:'