38 lines
1.1 KiB
HTML
38 lines
1.1 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<body>
|
||
|
</body>
|
||
|
<script>
|
||
|
function getQueryStrings() {
|
||
|
// Gets query parameters from the URL; e.g., given a URL like:
|
||
|
//
|
||
|
// http://<url>/my.html?test=123&bob=456
|
||
|
//
|
||
|
// returns params["test"] = 123, params["bob"]=456, etc.
|
||
|
var params = {};
|
||
|
|
||
|
// RegEx to split out values by &.
|
||
|
var r = /([^&=]+)=?([^&]*)/g;
|
||
|
|
||
|
// Lambda function for decoding extracted match values. Replaces '+' with
|
||
|
// space so decodeURIComponent functions properly.
|
||
|
function d(s) { return decodeURIComponent(s.replace(/\+/g, ' ')); }
|
||
|
|
||
|
var match;
|
||
|
while (match = r.exec(window.location.search.substring(1)))
|
||
|
params[d(match[1])] = d(match[2]);
|
||
|
|
||
|
return params;
|
||
|
}
|
||
|
qsParams = getQueryStrings();
|
||
|
if (qsParams["type"] != "") {
|
||
|
testElement = document.createElement(qsParams["type"]);
|
||
|
if (qsParams["id"] != "")
|
||
|
testElement.id = qsParams["id"];
|
||
|
testElement.src = qsParams["src"];
|
||
|
testElement.controls = true;
|
||
|
document.body.appendChild(testElement);
|
||
|
}
|
||
|
</script>
|
||
|
</html>
|