Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML HTML Objects Embedded Elements

Zoe Zuniga
Zoe Zuniga
5,766 Points

embed video in html 5 What am I doing wrong?

Nothing shows in any browser. What am I missing?

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>My Page</title>
</head>

<body>

<object width="560" height="315">
    <param name="movie" value="//www.youtube.com/v/igGWZ47dnOw?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/igGWZ47dnOw?hl=en_US&amp;version=3" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true">
 </embed>
</object>

</body>
</html>
James Barnett
James Barnett
39,199 Points

For future reference, check out this video for some tips on sharing code on the forum.

5 Answers

James Barnett
James Barnett
39,199 Points

I'm going to take a guess here you are trying to embed a YouTube video in an html file on your computer which isn't running a web server.

If that's the case ...

Protocol-less URLs don't work without a web server, so in that case just add http: in front of the URL.


> The main caveat to keep in mind when using the protocol-less reference is that it will fail on pages loaded via file:/// (i.e. HTML pages you load directly from disk to your browser). So, do be sure to include the http: protocol in the URL if you happen to be developing without a web server at all, but don’t worry about omitting it otherwise.

source: http://encosia.com/3-reasons-why-you-should-let-google-host-jquery-for-you/

Is that the only code you have in your document? If not, could you add the html code you used using the markdown cheatsheet guidelines?

James Barnett
James Barnett
39,199 Points

I just edited the post to add the necessary markdown, so the code formats correctly.

You are missing http: in your embed source code.

Zoe Zuniga
Zoe Zuniga
5,766 Points

OK great, thanks, that makes total sense. I am used to embedding code right into wordpress pages which are already on a server rather than just sitting on my computer at home. Duh!

shahardekel
shahardekel
20,306 Points

Hi Zoe,

Like Alexandra said you are missing http: in your embed and object src. If you're using chrome, usually you can easily debug these kinds of errors if you open the developer tools' console tab. If I recall, an error should be raised in the console. In chrome using the 'protocol independent' // instead of specifying http or https won't work when working on an html file (but if you've opened the file from a local server it should work normally).

Thank you for expanding on this. I wanted to go into it further but had to step away from the computer :)