if you have opened the second page which you want to pass variable from with window.open command, then it is easy.you can get the main page with the "opener" variable.Below is an example function to pass a value from the opened page to main (opener)page.