C
Carlos Aguayo
If I have a parent and a child window, and if I create an array in the
child window, and pass it as a parameter to the parent window, it's
still an array, and its methods still work (like the 'forEach').
However, if I try to figure out if it's an array by looking at the
constructor property, I get that it's not an array. I got this behavior
in IE6 and Firefox, is this a bug or am I doing something wrong? I
pasted the code below.
Thanks!
Carlos
parent.html
======================================================
<html><body><script type="text/javascript">
var childWindow = window.open("child.html", "childWindow");
function functionInParentWindow(anArray){
if (anArray.constructor == Array){
alert("expected behavior");
} else {
alert("bug?");
}
}
</script></body></html>
======================================================
child.html
======================================================
<html><body><script type="text/javascript">
var parentWindow = window.opener;
var anArray = [];
anArray.push('0');
parentWindow.functionInParentWindow(anArray);
</script></body></html>
======================================================
child window, and pass it as a parameter to the parent window, it's
still an array, and its methods still work (like the 'forEach').
However, if I try to figure out if it's an array by looking at the
constructor property, I get that it's not an array. I got this behavior
in IE6 and Firefox, is this a bug or am I doing something wrong? I
pasted the code below.
Thanks!
Carlos
parent.html
======================================================
<html><body><script type="text/javascript">
var childWindow = window.open("child.html", "childWindow");
function functionInParentWindow(anArray){
if (anArray.constructor == Array){
alert("expected behavior");
} else {
alert("bug?");
}
}
</script></body></html>
======================================================
child.html
======================================================
<html><body><script type="text/javascript">
var parentWindow = window.opener;
var anArray = [];
anArray.push('0');
parentWindow.functionInParentWindow(anArray);
</script></body></html>
======================================================