1
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
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
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 – 2013-02-26T22:12:07.187
1In the developer tools of your browser – slhck – 2013-02-26T22:20:49.460