1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Whats this script do?

Discussion in 'HTML & JavaScript' started by dandan, Dec 4, 2015.

  1. dandan

    dandan Regular Member

    Joined:
    Jan 7, 2009
    Messages:
    241
    Likes Received:
    51
    Anyone have any ideas what this script does? Just doing some snooping on a competitors page and can't figure out what this does.

    Code:
    <script>
    /*
     * window.onerror handler
     */
    /*window.onerror = function(message, url, line) {
        if (window.XMLHttpRequest) {
            var xhr = new XMLHttpRequest();
    
            // the url to post data to
            var logurl = "error.php";
    
            // serialize the POST params
            var logurl = logurl+'?message=' + message + '&url=' + url + '&line=' + line + '&userAgent='        + window.navigator.userAgent;
    
        var params = '';
    
            // open an asynchronous connection
            xhr.open("GET", logurl, true);
    
            // set the appropriate headers
            xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            xhr.setRequestHeader("Content-Length", params.length);
            xhr.setRequestHeader("Connection", "close");
    
            // send the request
            xhr.send(params);
        }
    
        // returning false triggers the execution of the built-in error handler
        return false;
    }
    window.mytime = new Date();
    function sendTime()
    {
        var p = document.createElement('iframe');
        var curTime = new Date();
        var spentTime = Math.round((curTime - window.mytime)/1000);
        var framesLength = document.getElementsByTagName("iframe").length;
        p.setAttribute('src', '/img4.jpg?'+spentTime+'_'+framesLength);
        p.setAttribute('width', 0);
        p.setAttribute('height', 0);
        p.setAttribute('frameborder', '0');
        document.body.appendChild(p);
    }
    setInterval(sendTime,5000);*/
    </script>
    
     
  2. Zapdos

    Zapdos Power Member

    Joined:
    Oct 22, 2011
    Messages:
    597
    Likes Received:
    708
    Location:
    Eastern North Carolina
    Technically nothing, it's commented out. Otherwise it will send a message to their server if the page errors out. There's also the function at the bottom that creates an no-sized iframe with the time spent on the page and updates it every 5 seconds so they can tell when you left it.
     
  3. dandan

    dandan Regular Member

    Joined:
    Jan 7, 2009
    Messages:
    241
    Likes Received:
    51
    aah cheers mate.. thought they where upto something but couldnt figure it out.
     
  4. revproxy

    revproxy BANNED BANNED Jr. VIP Premium Member

    Joined:
    Nov 20, 2015
    Messages:
    396
    Likes Received:
    100
    Gender:
    Male
    its looks like a tracker..
    its load 0x0 image that track activity...
    its called Pixel
     
  5. privateloader

    privateloader BANNED BANNED

    Joined:
    Nov 12, 2014
    Messages:
    134
    Likes Received:
    32
    @revproxy
    My thoughts the same. The code is almost self explanatory