In order to pass data between windows, I open new windows via the window.open
method and set a property of the newly opened window to an object. This allows me
Since your window's Object
and the source window's Object
aren't the same thing, an instance of one won't be an instance of the other. You can use Object.prototype.toString
to distinguish between objects and arrays:
if(Object.prototype.toString.call(m) === '[object Array]') {
// It's an array
} else {
// It's not
}
You can also use Array.isArray
, if available.
Here's a demo. (It uses an <iframe>
instead of a popup, by the way.)