简体   繁体   English

无法在模态中打开ShareThis的facebook“分享此”按钮

[英]Can't open ShareThis's facebook “share this” button in modal

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. 我刚刚在我的网站上实现了ShareThis的facebook分享按钮,我可以分享,但是,我想在模式(弹出窗口)中打开确认对话框,而不是每次都在新选项卡中打开。

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. 我看了一下ShareThis的文档, 在这里它说我只需要传递popup: 'true'在参数初始化时,我已经完成了,但它没有任何效果,任何时候按下按钮它打开了一个新标签。

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>

也许你有一些代码强制所有链接在新窗口中打开,尝试在js小提琴或测试页面中实现它。

Just a thought... You've set popup to 'true' instead of true. 只是一个想法...你已经将popup设置为'true'而不是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. 单引号的'true'使其成为拼写为'true'的字符串,如果ShareThis检查变量类型,则可能无法将其识别为有效值。 Try removing the quotes around 'true'. 尝试删除'true'周围的引号。

By the way, I'm having the same issue on gifMusic.com . 顺便说一句,我在gifMusic.com上遇到了同样的问题。 I'll have to give the popup thing a try as well. 我也必须尝试弹出一下这个东西。

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. 要使用popup: true执行共享操作的用户(或任何其他显示窗口的Facebook插件)应该已授权您的应用程序。

Otherwise it would always open in a new window. 否则它将始终在新窗口中打开。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM