Dynamic load then reinitializing addthis- gets slower and slower and slower on IE7

mobilelbs May 12, 2012 12:20PM EDT

I have included an html file (testAddthis.html) that loads a javascript file (testAddthis.js) which reinitializes the addthis buttons.
On IE7, if you more times you select the RELOAD button , the slower it gets. At first it takes 1 sec to load the buttons. By the tenth reload, it can take 10 seconds.






/***********************************************************/
/********* This is the testAddthis.html file ***********/



<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml" >
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml" >
<head>

<script src="media/system/js/jquery-1.4.2.min.js" type="text/javascript"></script>

</head>
<body>

<script>
function binjaLoadJavascript(src) {

if (typeof src=="string")
url = src;
else
url = src.arg1;

var e = document.createElement("script");
e.src = url;
//e.id = id;
e.type="text/javascript";
document.getElementsByTagName("head")[0].appendChild(e);

}
</script>

<script>
function reinitializeAddThis(){

if (window.addthis) {
window.addthis = null;
window._adr = null;
window._atc = null;
window._atd = null;
window._ate = null;
window._atr = null;
window._atw = null;
}
jQuery.getScript('http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4f9bc14f1447e624');

}
</script>
<!-- AddThis Button BEGIN -->

<script>
var addthis_config = {
services_compact: 'email,twitter, more',
services_exclude: 'facebook,print' ,
ui_open_windows:true
}
</script>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4f9bc14f1447e624"></script>


<div id='getWebpage'>

<div>


<div style='float:right'>
<div class='addthis_toolbox addthis_default_style '
addthis:url='http://www.yahoo.com'
addthis:title='Grab This!'
addthis:description='This is the description'>
<a class='addthis_button_preferred_1'></a> <a class='addthis_button_preferred_2'></a>
<a class='addthis_button_preferred_3'></a>
<a class='addthis_button_preferred_4'></a>
<span class='addthis_separator'>|</span>
<a href='http://www.addthis.com/bookmark.php?v=250&pubid=ra-4f9bc14f1447e624' class='addthis_button_compact'>More<
/a>
</div></div>
</div>


</div> <!-- end getWebpage -->


HELLO

<button onclick="binjaLoadJavascript('./testAddthis.js');">CLICK TO RELOAD </button>
</body>
</html>

/***********************************************************/
/********* This is the testAddthis.js file ***********/
jQuery('#getWebpage').empty(); jQuery('#getWebpage').html("<div> <div style='float:right'> <div class='addthis_toolbox addthis_default_style' addthis:url='http://www.yahoo.com' addthis:title='Grab This!' addthis:description='This is the description'> <a class='addthis_button_preferred_1'></a> <a class='addthis_button_preferred_2'></a> <a class='addthis_button_preferred_3'></a> <a class='addthis_button_preferred_4'></a> <span class='addthis_separator'>|</span> <a href='http://www.addthis.com/bookmark.php?v=250&pubid=ra-4f9bc14f1447e624' class='addthis_button_compact'>More</a> </div></div> <div>reloaded</div></div>");jQuery(document).ready(function($){reinitializeAddThis();});

Post Your Public Answer

Your name (required)
Your email address (required)
Answer (required)

Still need help?


General Topics

 

Developers