Skip to content Skip to sidebar Skip to footer

Passing A Variable With Window.opener Javascript

In the first page I have window.tmpstr = 'aaaaaa'; window.open ('second.php','_self',false); in second.php alert(window.opener.tmpstr) This alerts 'undefined'. when I change '_s

Solution 1:

You can't, not like that. By calling window.open using _self, you simply redirect the page to the second.php url.

Options you can use are :

  • Adding it as a parameter using the hash tag (second.php#tmpstr=aaaaaa
  • Using cookies (there is a nice jQuery cookie plugin)
  • Moving your whole page into a iFrame (not recommended) and redirecting only the main frame.

Post a Comment for "Passing A Variable With Window.opener Javascript"