Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

193
Visualizações
How to open another html file from a page with Query params

I have two html files

  1. index.html
  2. search.html

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?

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

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.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda