ShareThis buttons not clickable on HTTPS website

2019-04-30 06:35发布

问题:

I have added "share this" buttons to my secure site and now they produce an error when clicked. Errors are mentioned below. Has anyone had this problem before?

Blocked loading mixed active content "http://w.sharethis.com/button/buttons.js"

ReferenceError: stLight is not defined

Loading mixed (insecure) display content on a secure page "http://w.sharethis.com/images/facebook_32.png"

回答1:

Basically if a page is loaded over HTTPS then every resource it uses should also be loaded over HTTPS. It's a part of browser security policy, just like Same-Origin Policy etc.

Fortunately ShareThis can be used over HTTPS like this:

<script type="text/javascript" src="https://ws.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">
    stLight.options({
        publisher:'12345',
    });
</script>

Same applies to your facebook icon. Just use this URL: https://ws.sharethis.com/images/facebook_32.png



回答2:

Also for those that are having trouble debugging this stuff make sure to check out that your browsers aren't blocking ShareThis through an add-on.

Ref: stLight not defined issue related to addons