Why is it that every time I try to view the source of a website that plays HTML 5 video (like YouTube), I don't see the HTML video tag?

For example, on this site: http://www.youtube.com/watch?v=mzPxo7Y6JyA


1 Answer 1


You don't see the video tag if you just load the page source on its own. This is because the video DOM element is added to the page dynamically, with JavaScript, and not even persisted in the page source.

Here's the video tag in from your example:

It's inserted through JavaScript inside <div class="html5-remote-module"> after the video metadata and everything else has been loaded. One reason for not "hard-coding" the video tag inside the page is that the link to the video resource has to be present inside the tag (as the src attribute), and YouTube distributes the requests to a large number of caching servers rather than pointing to a single resource.

  • that's a great explanation. thanks. but where can i find that page source on your example (picture above)?
    – itagomo
    Feb 26, 2013 at 22:12
  • 1
    In the developer tools of your browser
    – slhck
    Feb 26, 2013 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.