0

I have the following code:

var my_window=window.open("print.php");
my_window.testValue="some value";

In print.php page I have this code:

alert(window.testValue);

This works in chrome and mozilla but does not work on IE, what might be the problem?

8
  • try use below instead of your code because You can't "pass" the array, but you can make it available as a global (or via a global), and your new page can use something like: var theArray = window.opener.theArray; Commented Jul 16, 2014 at 12:31
  • how to make variable global?? Commented Jul 16, 2014 at 12:37
  • var theArray = window.opener.theArray Commented Jul 16, 2014 at 12:39
  • Look at this stackoverflow.com/questions/5848333/… Commented Jul 16, 2014 at 12:40
  • I tried it, but didn't work, I don't know what I'm doing wrong!! Commented Jul 16, 2014 at 12:52

1 Answer 1

0

As you mentioned in comment using javascript array declare your value as global,

window.data = data;

as you asked make your variable global please look at Make Variable as Global JavaScript

And the use below code

var theArray = window.opener.theArray

More Info

Hope this helps...

Sign up to request clarification or add additional context in comments.

1 Comment

my array is javascript array not php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.