It's possible to pass data to a webpage using a query string. The URL looks like this:

http://localhost/page.html?foo=bar&yes

The query string is "?foo=bar&yes" in this example. This data is available in window.location.href from JavaScript. The code below defines two handy functions to operate on query strings.

function queryStringToObj(q) {
    var a = q.split('?')[1].split('&');
    var o = {};
    for(var i in a) {
        var pair = a[i].split('=');
        o[pair[0]] = decodeURIComponent(pair[1]);
    }
    return o;
}

function array_has(a, item) {
    return a.indexOf(item) >= 0;
}

The queryStringToObj function returns the query string as a new object. Each parameter becomes an attribute of the object. The array_has function checks to see if an attribute exists in the object.

For example, let's check to see if "foo" is in the query string "?foo=bar&yes".

function testQS() {
 if (typeof window === 'undefined') window = {location:{href:"?foo=bar&yes"}};
 var qs = queryStringToObj(window.location.href);
 return array_has(Object.keys(qs), 'foo') ? "foo is there" : "foo is not there";
}

testQS();
// returns: "foo is there"