Page 1
<html>
<head>
<script>
function keypress() {
var txt1 = document.getElementById("txt1");
var value = txt1.value;
setCookie('txt1value', value, 1)
}
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
var expires = "expires=" + d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
</script>
</head>
<body>
<input id="txt1" type="text" onkeypress="keypress()" onkeyup="keypress()"><br>
</body>
</html>
Page 2
<html>
<head>
<title>Page 2</title>
</head>
<body>
<span id="lbl"></span>
<script>
setInterval(function () {
var value = getCookie('txt1value')
document.getElementById('lbl').textContent = value;
}, 100)
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
</script>
</body>
</html>
Note: you will have to host the pages to make it work
Refer these
JavaScript Cookies[
^]
Window setInterval() Method[
^]