在 jQuery 移动应用程序中更改 AddThis 共享 URL
Changing the AddThis shared URL in a jQuery mobile application
我在jQuery Mobile应用程序中尝试动态更改要与AddThis共享的URL时遇到问题。
下面代码片段中的 response.url 是 Bitly 提供的 URL,例如"http://shorturl.com/hu7Hnm",但我无法使用此代码更改 URL。我在我们的桌面网站上做同样的事情,这工作正常,但它在我们的移动网站(由jQuery Mobile提供支持)上不起作用。
Twitter/Facebook/电子邮件弹出窗口仍然出现,但是它们会显示下面的更新代码更改之前的URL。所以它似乎没有任何影响。
// update the AddThis share url to the shortened URL
addthis.update('share', 'url', response.url);
addthis.url = response.url;
addthis.toolbox('.social_icons');
social_icons选择器针对下面包含 AddThis 图标的这个。
<ul class="social_icons inline_list">
这是我在页面加载时的共享设置示例:
var addthis_share = {
url: "http://www.wrestlemaniamainevent.com/shared/huih897897jkhjkh98907908nn",
title: "Check out the Main Events at www.wrestlemaniamainevent.com"
}
我找到了解决这个问题的方法。它需要在声明的开头指定window
对象。我相信这是使用jQM的一个怪癖。
window.addthis.toolbox('.social_icons', {}, {'url': response.url });
相关文章:
- 我如何修复包含在captcha的addthis中的错误
- Facebook共享显示一个接一个的空白页面
- 通过javascript/html访问twitter共享iframe
- 在我的SPA应用程序中集成Facebook共享的问题
- 在索引.html和应用.js [node.js] 之间共享变量
- AngularJS:$q.dedefe()不能由工厂方法共享
- 使用闭包共享构造函数参数
- 现在可以在加载addThis时显示加载吗
- Facebook共享动态参数链接
- Node.js上的WebSocket,并在所有连接的客户端之间共享消息
- 如何在没有插件和Wordpress的情况下创建共享社交媒体
- 在requirejs中共享实例化对象
- 在Javascript服务器/客户端中共享对象定义
- 使用服务(AngularJS)在控制器之间共享数据
- 如何将新用户自动添加到AddThis服务以设置分析服务
- 在 jQuery 移动应用程序中更改 AddThis 共享 URL
- 共享替代方案类似于addthis/sharethis
- 如何实现addthis与infinte卷轴和砖石共享
- 如何在jquery中使用addThis插件与图片共享帖子
- 如何刷新 AddThis Facebook 按钮的共享 URL