diff options
Diffstat (limited to 'app/webutil.js')
-rw-r--r-- | app/webutil.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/webutil.js b/app/webutil.js index a9fee32..ef23fcb 100644 --- a/app/webutil.js +++ b/app/webutil.js @@ -20,10 +20,19 @@ export function initLogging(level) { } // Read a query string variable +// A URL with a query parameter can look like this (But will most probably get logged on the http server): +// https://www.example.com?myqueryparam=myvalue +// +// For privacy (Using a hastag #, the parameters will not be sent to the server) +// the url can be requested in the following way: +// https://www.example.com#myqueryparam=myvalue&password=secreatvalue +// +// Even Mixing public and non public parameters will work: +// https://www.example.com?nonsecretparam=example.com#password=secreatvalue export function getQueryVar(name, defVal) { "use strict"; const re = new RegExp('.*[?&]' + name + '=([^&#]*)'), - match = document.location.href.match(re); + match = ''.concat(document.location.href, " ", window.location.hash).match(re); if (typeof defVal === 'undefined') { defVal = null; } if (match) { |