crmpicco crmpicco - 5 months ago 32x
Javascript Question

Changing the AddThis shared URL in a jQuery mobile application

I am experiencing an issue when attempting to dynamically change the URL to be shared with AddThis in my jQuery Mobile application.

The response.url in the code snippet below is a Bitly-provided URL such as "" however I am unable to change the URL with this code. I do the same thing on our Desktop site and this works fine, however it does not work on our Mobile site (which is jQuery Mobile powered).

The Twitter/Facebook/Email pop-ups still appear, however they show the URL before it has been changed by the update code below. So it does not appear to have any affect.

// update the AddThis share url to the shortened URL
addthis.update('share', 'url', response.url);
addthis.url = response.url;

The social_icons selector targets this below which holds the AddThis icons.

<ul class="social_icons inline_list">

This is an example of my sharing setup on page load:

var addthis_share = {
url: "",
title: "Check out the Main Events at"


I found the solution to this. It requires specifying the window object at the start of the declaration. I believe this is a quirk of using jQM.

window.addthis.toolbox('.social_icons', {}, {'url': response.url });