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

Embedded Images: Linking from a Page Question

I'm doing the Links HTML tutorial and attempting to very simply copy and paste the embedded code from "Charlie bit my finger - Again" within the body all by itself to show how it updates on my page. Here is the code:

<body>

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

</body>

When I save in Sublime Text 2 and refresh my Google Chrome Web page, a black square flashes very quickly (probably representing the YouTube link) but vanishes. I try to refresh again but nothing. If I refresh twice quickly it does begin thinking for 60-90 seconds but still the screen is blank.

Any thoughts would be most appreciated. Thank you.

3 Answers

I'm going to take a guess here you are trying to embed a YouTube video in an html file on your computer that doesn't 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/

Bam! Totally worked putting in the http: before the copied code!

Thanks so much James!

John

Hey John. You didn't actually show the code. Once we see that we can help you out.

Sorry, I thought I copied and pasted the code. I am (I believe) following the tutorial to the "T" and pulling the "Charlie bit my finger - again" from YouTube. This is to demonstrate the importance of "embedded" links due to older technology I think. Here is what I'm putting in:

<body>

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

</body>