Can't open ShareThis's facebook "share this" button in modal
Asked Answered
L

3

7

I've just implemented ShareThis's facebook share button on my site, and I can share fine, however, I would like to open the confirmation dialog in a modal (popup), instead of it opening in a new tab every time.

I had a look at ShareThis's documentation, and here it states that I just need to pass popup: 'true' in the parameters when initializing, which I have done, but it has no effect, any time the button is pressed it opens up in a new tab.

No errors are being thrown in the console, and the share functionality works fine, am I missing something?

Here is my code:

<script type="text/javascript" src="https://ws.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">
    //init
    stLight.options({popup:'true', publisher: "abcdef-1234-1234-1234-1234abcdef1234", doNotHash: false, doNotCopy: false, hashAddressBar: false});

    //create widget
    stWidget.addEntry({"service":"facebook", "element":document.getElementById('fb_share_button'), "url":"http://www.site.com/link/to/share/" , "title":"Title", "type":"hcount" });
</script>

<span st_url="<!-- url is assigned dynamically -->" class='st_facebook_hcount' displaytext='Facebook' id="fb_share_button"></span>
Lithographer answered 11/3, 2013 at 11:11 Comment(0)
A
0

Perhaps you have some code that's forcing all links to open up in a new window, try implementing it in a js fiddle or test page.

Aulic answered 12/3, 2013 at 7:53 Comment(0)
J
0

Just a thought... You've set popup to 'true' instead of true. 'true' with single quotes makes it a string of characters spelling out 'true' and if ShareThis is checking variable type, it may not recognize it as a valid value. Try removing the quotes around 'true'.

By the way, I'm having the same issue on gifMusic.com. I'll have to give the popup thing a try as well.

Jannajannel answered 17/8, 2013 at 13:35 Comment(0)
A
0

To use popup: true the user who is performing the Share action (or any other Facebook plugin that displays windows) should have authorized your application.

Otherwise it would always open in a new window.

Aphesis answered 27/8, 2013 at 10:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.