Problem
A javascript should read the browsers address bar to get GET Üarameters that have been appended to the adress bar.
Approach – Ansatz
Usage of decodeURIComponent
Solution
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
var myMap = getUrlParameter("map");
if (myMap) {
diagramType = myMap;
}
You can call now the script like this:
http://webseite.html?map=Test