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

276
Visualizações
How to pass values from one HTML page to other HTML page using Javascript

I have a HTML page (test.html), where i've a text box and a button. I'll enter some text in the text box and Click that button, it should open a new page (say google.com) and paste the value i entered in the previous page and automatically submit the page. I was able to achieve this in VB script which is supported in IE and not in Edge or Chrome. So is there a way we can achieve this using Javascript.

Tried, things like this, but it doesn't work.

    const testDiv = document.forms["actionForm"].getElementsByTagName("applicationIdentifier")
    testDiv.textContent = 'Hello world!'
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

JavaScript can only run within the page it is loaded on. Also, HTTP is stateless.

If you want to interact with other pages, they will need to support the interaction by means of their code allowing you to specify their state. For GET requests, this can be done using URL parameters. To take your example, Google supports a query parameter.

https://www.google.com/search?q=mdn+http

Most sites will not document this kind of thing because it is a strange way to interact. They usually expose their interactions via APIs.

open a new page (say google.com) and paste the value i entered in the previous page and automatically submit the page

If you want to actually simulate these user actions, this cannot be done from the browser. At that point, you are describing a WebDriver, for example Selenium or WebDriverIO.

It is even possible to experiment with something like java.awt.Robot here, but I do not recommend it.

If by chance I am off-base and you just want a Google search bar for your site, there are ways to do that.

https://support.google.com/programmable-search/answer/4513903?hl=en

Depending on your goals, <iframe> might also suit your ideas. But using <iframe> is generally not recommended.

about 4 years ago · Juan Pablo Isaza 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