As your URI will be dynamic in your localhost and staging and after deploy states, you can't directly check for all url you need as you try!
You can use some of string methods like includes
or indexOf
on the url that you are getting from window.location.pathname
or window.location.href
.
Also if you ONLY want to get the urls params of the string, you can pass the result string into a Url constructor lie below:
const url = new URL(window.location.href);
const params = url.searchParams.get("sanayi");
console.log(param)
and get all of your query params out of your url!
but make sure to assign them a value like:
http://localhost:8080/financing-form.html?sanayi=false&anotherValue=blahblahblah
by then you can get your values like:
console.log(url.searchParams.get('sanayi')) // would give you: false
console.log(url.searchParams.get('anotherValue')) // would give you: blahblahblah