We're trying to pick up a query-string parameter from a node red dashboard URL so that on load we can fetch some relevant information from other API's.
for instance NR DB url is
http://192.168.0168:1880/ui/#!/0?socketid=ulqQqlNfnVd11haOAAAT&mcID=H01
we want to strip out the mcID=H01.
In JS we would normally use either
let params = (new URL(document.location)).searchParams;
let name = params.get("mcID")
or more basic
var mcid='';
var url = window.location.href
.slice(window.location.href.indexOf("?") + 1)
.split("&");
for (var i = 0; i < url.length; i++) {
var urlparam = url[i].split("=");
if (urlparam[0] == 'mcID') {
mcid= urlparam[1];
}
Any suggestions?