Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

275
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!