Add custom poster frame to youtube video without the API
The trick is adding the iframe in a comment. Javascript reads comment contents and saves iframe definition to a var. When user clicks on the image, javascript overwrites container innerHTML using the iframe defined in the comments.
https://gist.github.com/4438876
This code is also valid in browsers not supporting window.postMessage (API uses postMessage).
Written by Sergi Meseguer
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Postmessage
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#