function getParamFromUrl(paramName) {
  paramName = paramName.toLowerCase();
  let url = new URL(document.location.href.toLowerCase());
  let getSearch = (searchStr) => {
      let res = {};
      if (searchStr[0] != '?') {
        return res;
      }
      searchStr = searchStr.slice(1);
      searchArr = searchStr.split("&");
      searchArr.forEach((param) => {
          param = param.split('=');
          if (param[0] != '')
              res[param[0]] = param[1];
      });
      return res;
  }
  let res=url.searchParams.get(paramName);
  if (!res) {
    res = getSearch(url.search)[paramName];
  }
  return res;
}

function getParamFromUrlDef(paramName, defaultValue) {
  let res = getParamFromUrl(paramName);
  if (!res)
    res = defaultValue;
  return res;
}
