Why does embedding videos from youtube work on my local host but not when it is in C drive
eg: http://localhost/test/test.html (embedded video works )
file:///C:/Users/AUser%20name/Desktop/test/test.html (embedded video does not work)
this is my snippet of code to embedd the video
<object width="560" height="315"><param name="movie" value="//www.youtube.com/v/0l-
7IGRsORI?hl=en_US&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&version=3" type="application/x-
shockwave-flash" width="560" height="315" allowscriptaccess="always"
allowfullscreen="true"></embed></object>
Because you use the // at the beginning of the url, meaning you inherit the currently used protocol. At your host it is http:// (good), but at your C drive it's file:// (bad).
So just use http:// instead of //:
<object width="560" height="315">
<!-- See: value="http://.. -->
<param name="movie" value="http://www.youtube.com/v/0l-7IGRsORI?hl=en_US&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&version=3" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed>
</object>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With