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

Rought Interpretation

Discussion in 'HTML & JavaScript' started by drumltd, May 21, 2011.

  1. drumltd

    drumltd Regular Member

    Joined:
    Dec 4, 2008
    Messages:
    467
    Likes Received:
    13
    As a PHP programmer, can anybody give me a rough brief on what this does

    <![CDATA[
    (function(g){
    var l = g.location,
    host = l.hostname,
    path = l.pathname,
    a = l.href.replace("#%21","#!");

    a=a.split("#!")[1];

    if(a){
    g.location.hash = "";
    g.location="https://" + host + a.replace(/^([^\/])/,"/$1");
    } else {
    g.location="https://" + host + path + l.search;
    }
    })(window);
    //]]>


    My PHP code is getting this return about 1 in 5 times from a site I'm interfacing with, run exactly the same query in Firefox it works fine, but from PHP, the other 4/5 times it works just fine. I suspect the site is try to test wether I can run javascript. So what do I need to do to trick it?

    Is $1 an actual variable or does it actually add "$1" to the url??