Jump to content

passing variables/function window.open


Matej

Recommended Posts

Hello , lets say i have two sites 1) web.com 2) web.com/areyousure

. Both have own stylesheets and js files.

 

On first site (web.com) i use window.open("web.com/areyousure"). Is there any way to pass variables/functions to the second site from the parent site?

 

 

Link to comment
Share on other sites

pass it like this?

var parent="Im a parent site";var newSite=window.open("blabla.org");newSite.parentsite=parent;newSite.addEventListener("load",function(){alert(newsite.parentsite)},ture)  

If this is right way , what is right way to use passed variable/function on the opened site its like i used it (newsite.parentsite) or just simply using alert(parentsite)?

 

//

or you mean like this

 window.foo="im a parent site";window.open(" web.com/areyousure");

and just use "window.opener.foo" in newly opened window?

Edited by Matej
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...