I need to change a url parameter after reloading the page. When I refresh the page, need to change that parameter's value.
window.location.href = myUser + '?myuserid=' + myuserid + '&product=' + product + '&domain=' + domain + '&isPassed=' + true;
After reloading page, I have to change the value of isPassed to false.
Hope your support to solve my problem. Thank you
This can be done by modifying the document.location.search. Urls are broken down into protocol (Http, https), hostname (www.stackoverflow.com), pathname (/questions/71790720/how-do-i-change-the-url-parameters-after-reloading-the-page), search (?param1="something"¶m2=...), and hash (#something). All of these are accessible with window.location.
const user = "Eric"
const userId = 1
const product = "banana"
const domain = "something"
const isPassed = false
window.location.search = `${user}?
myuserid=${userId}&product=${product}&domain=${domain}&isPassed=${isPassed}`