Including Twitter Widgets.js via HTTPS

后端 未结 6 2119
面向向阳花
面向向阳花 2021-02-08 03:23

I\'m having a minor problem with Mixed-content on HTTPS served pages on our site, when we include the http://platform.twitter.com/widgets.js

Apparently Twitter doesn\'t

6条回答
  •  青春惊慌失措
    2021-02-08 03:43

    There is an easier workaround using PHP that requires no maintenance, unless Twitter changes their JS file location.

    Create a PHP file in your JS folder, called twitter.platform.js.php or something along those lines. Paste the following into the file.

    
    

    Then include the PHP script instead of Twitter's JS.

    
    

    The above code will pull Twitter's non-secure JS from their server and render the output as JavaScript and allow you to serve it over SSL without the warnings, as it will originate from your site.

    Update: The above workaround does, as @paul-mcmahon mentioned in the comments, cause SSL errors, when using the Twitter Follow button.

提交回复
热议问题