Get value from one window to another window - javascript

Is it possible to get the value from the first page to the second page. BUT without FORM

Can I use window.parent.document.getElementById ("") value ...

But this works in the popup, but I need this for two pages that redirect from the first page to the second page.

0


source to share


3 answers


If you are redirecting from one page to another, you MUST use form elements to navigate from page to page or use the request value. That's it, Javascript is NOT aware of the structure of the previous page.



+1


source


or you can use cookies ...



+1


source


You can also just use GET variables by calling site.com/index.php?info=value

and escaping the content value

. The url can be changed dynamically, for example:

<input type="text" id="the_value" />
<a href="#" onclick="return updateURL()" id="the_link">Click me</a>
<script type="text/javascript">
function updateURL()
{
    document.getElementById('the_link').href =
        'site.com/index2.php?info=' +
        encodeURIComponent(document.getElementById('the_value'));
    return true;
}
</script>

      

0


source







All Articles