Live customer support system Demo Signup Forums Downloads Contact

How to make LiveAdmin faster

Guides, helps, etc

Moderator: Ace

How to make LiveAdmin faster

Postby liveadmin » Sun Sep 20, 2009 10:01 pm

LiveAdmin may cause your pages to load a bit slower, that's how an external JavaScript like LiveAdmin or Google Analytics do. To make them load faster you may add some extra codes to load it dynamically.

Assume you are loading the LiveAdin using this code:

Code: Select all
<script language="javascript" type="text/javascript" src="http://www.liveadmin.net/client/liveadmin.php?key=L1ED164CV46B2D6M131A84"></script>


You can replace it with:

Code: Select all
<script language="javascript" type="text/javascript">
if(navigator.userAgent.indexOf("Safari") != -1)
        var LV_ininter=window.setInterval("LV_CheckInit()",100);
else
        var LV_ininter=window.setInterval(function(){ LV_CheckInit(); },100);
var LV_TrigCount=0;
function LV_CheckInit()
{
        LV_TrigCount++;
        if(typeof(document)!='undefined' && typeof(document.getElementsByTagName('head'))!='undefined' && typeof(document.getElementsByTagName('head')[0])!='undefined')
        {
                window.clearInterval(LV_ininter);

                // Replace the site key with your own
                var LiveAdminSiteKey = 'L1ED164CV46B2D6M131A84';
                // Replace the tag with ID of the span element or leave it as is if span has no ID
                var LiveAdminTag = 'liveadmin';

                var LV_THost = (("https:" == document.location.protocol) ? "https://www." : "http://www.");
                var ss = document.createElement('script');
                ss.src = LV_THost+'liveadmin.net/client/liveadmin.php?key='+LiveAdminSiteKey+'&tag='+LiveAdminTag;
                var hh = document.getElementsByTagName('head')[0];
                hh.appendChild(ss);
        }
        else
        {
                if(LV_TrigCount>100)
                        window.clearInterval(LV_ininter);
        }
}

</script>


Here is another code, not as efficient as the first code, but small enough for intermediate web masters:

Code: Select all
<script language="javascript" type="text/javascript">
// Replace the site key with your own
var LiveAdminSiteKey = 'L1ED164CV46B2D6M131A84';
// Replace the tag with ID of the span element or leave it as is if span has no ID
var LiveAdminTag = 'liveadmin';

var LV_THost = (("https:" == document.location.protocol) ? "https://www." : "http://www.");
document.write(unescape("%3Cscript src='" + LV_THost + "liveadmin.net/client/liveadmin.php%3Fkey%3D" + LiveAdminSiteKey + "%26tag%3D" + LiveAdminTag + "' type='text/javascript'%3E%3C/script%3E"));
</script>



Farhad Malekpour
liveadmin
 
Posts: 101
Joined: Sat Feb 28, 2009 8:30 pm

Return to Guides and FAQs

Who is online

Users browsing this forum: No registered users and 1 guest

cron