From 8695c49ed59cbd6473011050fe439fbff5d78a1c Mon Sep 17 00:00:00 2001 From: Nick Webb Date: Fri, 18 Nov 2016 09:35:39 +0000 Subject: [PATCH] Fix parseQueryString The parseQueryString method in xAPIWrapper takes no account of hashes potentially appearing after the search paramters. --- src/xapiwrapper.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/xapiwrapper.js b/src/xapiwrapper.js index e2ae4f9..babcab6 100644 --- a/src/xapiwrapper.js +++ b/src/xapiwrapper.js @@ -1167,18 +1167,16 @@ function isDate(date) { // parses the params in the url query string function parseQueryString() { - var loc, qs, pairs, pair, ii, parsed; - - loc = window.location.href.split('?'); - if (loc.length === 2) { - qs = loc[1]; - pairs = qs.split('&'); - parsed = {}; - for ( ii = 0; ii < pairs.length; ii++) { - pair = pairs[ii].split('='); - if (pair.length === 2 && pair[0]) { - parsed[pair[0]] = decodeURIComponent(pair[1]); - } + var qs, pairs, pair, ii, parsed; + + qs = window.location.search.substr(1); + + pairs = qs.split('&'); + parsed = {}; + for ( ii = 0; ii < pairs.length; ii++) { + pair = pairs[ii].split('='); + if (pair.length === 2 && pair[0]) { + parsed[pair[0]] = decodeURIComponent(pair[1]); } }