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

Object element does not work

I copied the embed code from youtube to display on webpage. But it does not work in Chrome, IE9 and SeaMonkey.

3 Answers

Hi Karthikeyan,

If you're testing this locally then the protocol-less url won't work. You have to add http: in front of the url's for both the object and embed tags

Thanks a lot Jason Anello. It got fixed now.

Ben Falk
Ben Falk
3,167 Points

You may need to post the code you are using, and how you are using it (embedded within HTML? Within a CMS such as Wordpress?) I've used YouTube's embed codes before, and they have always worked fine for me.

This is code I used: I used them inside HTML

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

I'm not sure if the forum stripped out your code? Make sure to look at the "Markdown Cheatsheet" link below, and enclose any code within three backticks so the forum understands it properly.

Please check now. I edited it to display the code.

Ben Falk
Ben Falk
3,167 Points

When I do a test of the code:

http://falkendev.com/test/youtube.html

I'm not having any problems. I haven't checked SeaMonkey, but it's working fine for me in Chrome and IE11/IE9. Are you sure you are entering the code in an appropriate place in your HTML file, within the <body> section? (check the source code in the link above).

Ben Falk Thanks. Jason Anello mentioned. I am testing it locally. So the URL in the value attribute and src attibute were with no protocol mentioned. So it did not work.

Now It is fixed by adding http protocol to them.