Youtube Iframe on HTTPS Website

I have included an iframe pointing to a YouTube video using https. Although I inserted a YouTube video using "https: //", the video uploads http files when I click on playback, making the browser security icon "insecure." How to make youtube upload https files only?

My HTML input:

<iframe id="ytplayer" type="text/html" width="480" height="360" src="//www.youtube.com/embed/-ZUrjLs48a8" frameBorder="0" allowfullscreen></iframe> 
+6
source share
1 answer

Add the source parameter to the url as described in the google api documentation: YouTube API API Link for iframe attachments

As an additional security measure, you should also specify the origin parameter in the URL, specifying the URL scheme (http: // or https: //) and the full domain of your main page as the parameter value. While the source is optional, it also protects against malicious third-party JavaScript that enters your page and takes control of your YouTube player.

  <iframe id="player" type="text/html" width="640" height="390" src="http://www.youtube.com/embed/u1zgFlCw8Aw?enablejsapi=1&origin=http://example.com" frameborder="0"></iframe> 
+10
source

All Articles