0

I've installed and configured the AddThis module to show sharing buttons to my users. It works great on my local machine. When I put the site on my SSL/HTTPS enabled site however the buttons do not show up (although I see the they are in in the page inspector) and Chrome gives me JavaScript errors that the script being used to get those icons is calling from http://s7.addthis.com/js/300/addthis_widget.js...a not-secure link and is being blocked).

Does anyone know how to change the link the addthis module is calling to make it SSL/HTTPS compatible?

  • 1
    I think this work for you apply patch drupal.org/files/1403210-https_breaking-1.patch – vgoradiya Jan 5 '16 at 6:58
  • I don't have the line it says to remove in the code in my version of the module (7.x-4.0-alpha6). Instead I have a conditional statement for getWidgetUrl that seems to suggest it tests whether or not I'm using 'https' by which I suppose it fails. – Sage Jan 5 '16 at 9:12
  • this patch code is already implemented with the function public function transformToSecureUrl($url) in alpha version. – vgoradiya Jan 5 '16 at 9:38
  • I see, so why doesn't it work? – Sage Jan 5 '16 at 20:44
1

/admin/config/user-interface/addthis/advanced Service URL's and you can put https instead of http and problem is fixed!

| improve this answer | |
1

I ended up contacting AddThis and they told me the Drupal module is outdated, and to instead use this code:

    <script type="text/javascript" 
src="https://s7.addthis.com/js/300/addthis_widget.js"></script>
    <div class="addthis_toolbox addthis_default_style addthis_32x32_style 
">
    <a class="addthis_button_facebook"></a>
    <a class="addthis_button_twitter"></a>
    <a class="addthis_button_email"></a>
    <a class="addthis_button_pinterest_share"></a>
    <a class="addthis_button_compact"></a>
    <a class="addthis_counter addthis_bubble_style"></a>
    </div>

So I put the first line (the tag) in my html.tpl.php file and put the rest of the code in a block in my footer. I had to make sure to put all the tags on the same line otherwise Drupal was forcing
tags between them making it impossible to style the toolbox correctly. Making sure the block content was set to 'Full HTML' and I was good to go.

The negative of this approach is that it requires another call to an external script. The positive is it negates the need for another module - you can safely remove 'addthis'.

| improve this answer | |
0

Use secure pages module and make this Switch back to http pages when there are no matches option checked on below config page.

sitename/admin/config/system/securepages

| improve this answer | |
  • The OP was asking about how to show addthis on https pages. Your answer does not address the issue. – Alfred Armstrong Apr 25 '17 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.