I have two html files
on button click I want to open search.html and pass in some query params in URL.
I did this
const params = new URLSearchParams({
sol: something,
art: art,
querytext: getStartedText
}).toString();
window.location.href = "search.html/query?" + params
Which open this in new tab
file:///Users/someone/Desktop/someProject/search.html/query?sol=Select+SME+Area&art=Select+Artifact+Types&querytext=
but with 404 error saying that your file couldn't be found.
If I do just this
window.location.href = "search.html"
It opens search.html page. Any idea on how I can fix it?
This slash at the end makes the file system think that it's a folder
window.location.href = "search.html/query?" + params
It should rather look like this:
window.location.href = "search.html?" + params
P.S.
You should consider using a local web server as working with file protocol isn't the best practice and can lead to unexpected behaviors when the website will be deployed.