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!'
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.