Add Window Load Event Without jQuery

Let’s say that you would like to trigger you code after the page is done loading. Easy, just use jQuery to attach a listener to the ready event (e.g. $(function() { ….}); OR $(document).ready(function() {…}) ). But what if jQuery isn’t loaded yet? Well, here is something that you can try.

 

function callback() {
    /* your code here */
}

'attachEvent' in window && window.attachEvent('onload', callback, false);
'addEventListener' in window && window.addEventListener('load', callback, false);

Tracking Pixel Code

function getAllInfos(url) {
    url += "?ver=1";
    url += "&url=" + escape(location.href);
    url += "&ref=" + escape(document.referrer);
    url += "&ua=" + escape(navigator.userAgent);
    url += "&reso=" + escape(screen.width + "x" + screen.height);
    url += "&greu=" + escape(document.body.clientWidth + "x" + document.body.clientHeight);
    url += "&rand=" + escape(Math.random());
    return url;
}
document.writeln("");