2nd attempt fix for #734 -- tests pass in all browsers

git-svn-id: http://svn.openlayers.org/trunk/openlayers@3328 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2007-06-14 19:11:45 +00:00
parent eac277f106
commit 385da5c614
2 changed files with 32 additions and 6 deletions

View File

@@ -609,15 +609,30 @@ OpenLayers.Util.getArgs = function(url) {
if(url == null) {
url = window.location.href;
}
var query = (url.indexOf('?') != -1) ? url.substring(url.indexOf('?') + 1)
: '';
var start = url.indexOf('?');
var stop = url.indexOf('#');
if (start != -1) {
if (stop != -1) {
var query = url.substring(start + 1, stop);
} else {
var query = url.substring(start + 1);
}
} else {
return {};
}
var args = new Object();
pairs = query.split(/[&;]/);
for(var i = 0; i < pairs.length; ++i) {
keyValue = pairs[i].split(/=/);
if(keyValue.length == 2) {
args[decodeURIComponent(keyValue[0])] =
decodeURIComponent(keyValue[1]);
keyValue = pairs[i].split('=');
if (keyValue[0]) {
if (keyValue[1]) {
args[decodeURIComponent(keyValue[0])] = decodeURIComponent(keyValue[1]);
} else {
args[decodeURIComponent(keyValue[0])] = '';
}
}
}
return args;