Create a blank .js file (eg. GetQueryString.js) and copy the following code in it
function getParameterByName(name) {
var match = RegExp('[?&]' + name + '=([^&]*)')
.exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
var urlParams = {};
(function () {
var e,
a = /\+/g,
r = /([^&=]+)=?([^&]*)/g,
d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
q = window.location.search.substring(1);
while (e = r.exec(q))
urlParams[d(e[1])] = d(e[2]);
})();
Include GetQueryString.js file in your code
<script type="text/javascript" src="~/GetQueryString.js" />
If your key is in URL as follows
http://www.domain.com?key=123
key can be fetched from above URL by following call
var queryStringValue = getParameterByName("key");