6 function getQueryStrings() {
7 // Gets query parameters from the URL; e.g., given a URL like:
9 // http://<url>/my.html?test=123&bob=456
11 // returns params["test"] = 123, params["bob"]=456, etc.
14 // RegEx to split out values by &.
15 var r = /([^&=]+)=?([^&]*)/g;
17 // Lambda function for decoding extracted match values. Replaces '+' with
18 // space so decodeURIComponent functions properly.
19 function d(s) { return decodeURIComponent(s.replace(/\+/g, ' ')); }
22 while (match = r.exec(window.location.search.substring(1)))
23 params[d(match[1])] = d(match[2]);
27 qsParams = getQueryStrings();
28 if (qsParams["type"]) {
29 testElement = document.createElement(qsParams["type"]);
31 testElement.id = qsParams["id"];
32 testElement.src = qsParams["src"];
33 testElement.controls = true;
34 document.body.appendChild(testElement);