javascript Sharethis 插件不适用于 https://

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26902101/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 06:39:38  来源:igfitidea点击:

Sharethis plugin not working with https://

javascriptphpsslsharethis

提问by Gokul Shinde

I have changed my site domain from http://to https://and I have added sharethis plugin in my site.

我已将我的站点域从 更改http://https://并在我的站点中添加了 sharethis 插件。

It was working fine with http://but now no buttons of share this displaying when I try to access my site using https://.

它工作正常,http://但现在当我尝试使用https://.

The following is the url of my site:

以下是我网站的网址:

https://www.placementbooster.ch/

https://www.placementbooster.ch/

I have changed http://w.sharethis.com/button/buttons.jsto https://ws.sharethis.com/button/buttons.jsand http://s.sharethis.com/loader.jsto https://s.sharethis.com/loader.js.

我已经改变了http://w.sharethis.com/button/buttons.jshttps://ws.sharethis.com/button/buttons.jshttp://s.sharethis.com/loader.jshttps://s.sharethis.com/loader.js

But still it is showing error:

但它仍然显示错误:

ReferenceError: sharethis is not defined

参考错误:sharethis 未定义

回答by NiloVelez

Adapted from the docs:

改编自文档:

https://support.sharethis.com/hc/en-us/articles/217916188-Moving-from-HTTP-to-HTTPS-SSL-Support

https://support.sharethis.com/hc/en-us/articles/217916188-Moving-from-HTTP-to-HTTPS-SSL-Support

Regular ShareThis Script

定期分享此脚本

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

Secure ShareThis Script

安全 ShareThis 脚本

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

I'm using this code ant it is loading correctly without any mixed-content issues

我正在使用此代码蚂蚁它正确加载没有任何混合内容问题

回答by Adam Lane

I was getting "stLight" is not defined and found a blog postabout moving to HTTPS. It basically says change "http://w" to "https://ws" and following it solved that problem. The post does have a link with "https://ss" in it. Perhaps you need to change "https://s" to "https://ss"?

我发现“stLight”未定义,并找到了一篇关于迁移到 HTTPS的博客文章。它基本上说将“ http://w”更改为“ https://ws”,然后解决了该问题。该帖子确实有一个带有“ https://ss”的链接。也许您需要将“ https://s”更改为“ https://ss”?

回答by Mayur Nirmal

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

This has solved our issue.

这已经解决了我们的问题。