how to embed a youku video on an HTTPS site?

后端 未结 2 464
一生所求
一生所求 2021-02-05 17:40

I have a site with HTTPS configured.

My client wants me to embed a youku video. At first the browser blocked the iframe since it had HTTP protocol on it.

I cha

相关标签:
2条回答
  • 2021-02-05 18:13

    Youku player serves some resources (like preview images or alternative sources for video) under http, not https - and this might be the main culprit of "partially insecure content" issue in browsers. This problem is caused by Youku player itself, it's quite possible to change the code loaded from their servers.

    However, the problem can be solved in most simple and convenient way by rewriting insecure http requests on given page with secure https requests - it possible to achieve this by including CSP meta tag in page header:

      <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
    

    The "Content-Security-Policy" response header allows to control resources the user agent is allowed to load on given page (more information here).

    What "upgrade-insecure-requests" directive does: "Instructs user agents to treat all of a site's insecure URLs (those served over HTTP) as though they have been replaced with secure URLs (those served over HTTPS). This directive is intended for web sites with large numbers of insecure legacy URLs that need to be rewritten."

    The original solution was found in this post.

    0 讨论(0)
  • 2021-02-05 18:16

    hi,we had supported(sorry for later)

    for example:

    1

    <iframe height=498 width=510 src='https://player.youku.com/embed/XMTg3Nzg4MzY4NA==' frameborder=0 'allowfullscreen'></iframe>
    

    2

    https://player.youku.com/player.php/sid/XMTg3Nzg4MzY4NA==/v.swf
    

    3:

    <embed src='https://player.youku.com/player.php/sid/XMTg3Nzg4MzY4NA==/v.swf allowFullScreen='true' quality='high' width='480' height='400' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash'></embed>
    
    0 讨论(0)
提交回复
热议问题