andy_button — 2013-08-18T09:17:12-04:00 — #1
I'm relatively new to the forum so forgive me if this is a naive question or something that's been asked a billion times before. This is fairly straightforward, so I'm sure it's come up here before... However, I ran a search and didn't find anything.
Basically, I can't get Youtube video embeds to work in HTML5 documents.
If I just run a normal (X)HTML document, starting with this formatting:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
I can run a youtube embed like, <iframe width="420" height="315" src="//www.youtube.com/embed/oUjUTG3hwyQ" frameborder="0" allowfullscreen></iframe> and it will show perfectly.
But if I use the HTML5 formatting:
<meta charset= "UTF-8">
I won't get a video. Instead, in Chrome, it will say "the file or directory cannot be found." In internet explorer, it will say "page cannot be displayed."
What's going on here?
scout1idf — 2013-08-18T13:58:20-04:00 — #2
The YouTube address is missing http: in the beginning.
It should be......
ralphm — 2013-08-19T04:35:12-04:00 — #3
That is the actual code YouTube supplies, and it works OK—but I think the page has to be online for it to work. Locally (for testing purposes) you may indeed need to add in the http:// bit.
But the doctype is not the issue here.
stomme_poes — 2013-08-19T11:03:49-04:00 — #4
The missing "http" is done on purpose: the URL may be HTTP, or it may be HTTPS. This can allow the browser or an app to choose which is used instead of hardcoding it.
jonmatthews — 2013-08-29T08:27:47-04:00 — #5
I completely agree with ralph.m & Stomme poes. One extra point, your example html 5 isn't valid (you have two html open tags)....
... the page won't be completely valid anyway (un-tweaked YouTube embeds aren't valid html 5) but I'd definitely fix that.