Skip to content Skip to sidebar Skip to footer

Youtube Api Dynamic Iframe

I'm trying to load a youtube video dynamically (iframe is generated on click after the page has loaded) with the ability to control the playback using the Youtube API. What I have

Solution 1:

Small typo in enbalejsapi=1 should be enablejsapi=1

Add iframe sandbox attributes so that outer script can access the iframe

iframe.setAttribute( "sandbox", "allow-same-origin allow-scripts" );

Post a Comment for "Youtube Api Dynamic Iframe"