0

How could i pass some data to my window.open() ? For example: I am in site1.com and using window.open("http://site2.com");

The questing is - how to crossbrowser pass some data via js to that site1.com

user2573863
  • 643
  • 1
  • 9
  • 18

2 Answers2

0

The easiest way to pass data between pages is to build a query string like this:

window.open("http://site2.com?parameter1=foo&parameter2=bar&etc=whatever");
WillardSolutions
  • 2,316
  • 4
  • 28
  • 38
0

When one page opens another the function window.opener() can return values to a particular function in the opening page. Look it up for details. I don't have a development box in front of me so its difficult to show good examples. I know I've done it this way in the past. Like a popup allowing choices to be made by user then close child form and pass choice back to parent form.

Dean.DePue
  • 1,013
  • 1
  • 21
  • 45
  • Unfortunately window.opener is only working for same domain. If i try to change something in the other domain it is going to be an error: `"SecurityError: Blocked a frame with origin "http://site2.com" from accessing a cross-origin frame."` – user2573863 May 13 '14 at 15:16