Introduction
In this article, you will see how to let two tabs in a browser communicate with each other.
Using this article I will show you how text written on one page of a browser can be automatically updated whenever you change the text on another page.
In this article, we will mainly use the JavaScript and Cookies of the browser.
Step 1
First of all, add two HTML pages to your Visual Studio.
Rename the first of the HTML pages to Transfer and the other one to Collector.
We will first work on the Transfer Page, this will be the page where we will write our message.

Step 2
In the Transfer Page, we will use a TextBox and a Button. The TextBox will the area where we will write our message and the button will be used to reset all the entered information.
On this page, we will create two functions named setCookie and reset information. These functions will help to set the values of the cookies and to reset the TextBox on the click of the button.
Its complete information will be like this:
- <h1>Information Transfer</h1>
- <p>
- Write into the TextBox and after that go to the second page
- </p>
- <form name="transfer">
- <input type="text" name="sendinformation" size="30" value="">
- <input type="reset" value="Reset">
- </form>
- <script type="text/javascript"><!--
- function setCookie(value) {
- document.cookie = "cookie-msg-test=" + value + "; path=/";
- return true;
- }
- function resetinformation() {
- var res = document.forms['transfer'].elements['sendinformation'];
- setCookie(res.value);
- setTimeout(resetinformation, 100);
- }
- resetinformation();
- //--></script>
Step 3
Now we will work on the second page which is "Collector".




Join the conversation! Your thoughts help the community grow.