【问题标题】:Embedding YouTube Videos doesn't work in local HTML files (using file:// URL)在本地 HTML 文件中嵌入 YouTube 视频不起作用(使用 file:// URL)
【发布时间】:2013-07-21 21:32:27
【问题描述】:

为什么嵌入来自 youtube 的视频在我的本地主机上可以工作,但在 C 盘中却不行

eg: http://localhost/test/test.html                (embedded video works ) 

file:///C:/Users/AUser%20name/Desktop/test/test.html  (embedded video does not work)

这是我嵌入视频的sn-p代码

<object width="560" height="315"><param name="movie" value="//www.youtube.com/v/0l-
7IGRsORI?hl=en_US&amp;version=3"></param><param name="allowFullScreen" value="true">
</param><param name="allowscriptaccess" value="always"></param><embed
src="//www.youtube.com/v/0l-7IGRsORI?hl=en_US&amp;version=3" type="application/x-
shockwave-flash" width="560" height="315" allowscriptaccess="always"
allowfullscreen="true"></embed></object>

【问题讨论】:

    标签: html web youtube


    【解决方案1】:

    因为你在url的开头使用了//,意味着你继承了当前使用的协议。在您的主机上是 http://(好),但在您的 C 盘上是 file://(坏)。

    所以只需使用http:// 而不是//

    <object width="560" height="315">
        <!-- See: value="http://.. -->
        <param name="movie" value="http://www.youtube.com/v/0l-7IGRsORI?hl=en_US&amp;version=3"></param>
        <param name="allowFullScreen" value="true"></param>
        <param name="allowscriptaccess" value="always"></param>
    
        <!-- See: src="http://.. -->
        <embed src="http://www.youtube.com/v/0l-7IGRsORI?hl=en_US&amp;version=3" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed>
    </object>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-07
      • 1970-01-01
      相关资源
      最近更新 更多