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 not only to pass data, but to share the instance of the variable, meaning if I modify the object, or any of its derived properties, on one window, it modifies it on all windows.
The problem, however, is something is going very funny with the instanceof operator.
When I do
typeof m
m instanceof Object
The first line returns "object"
while the second one returns false
.
I specifically need the instanceof operator to check between arrays and objects.
Here is a fiddle of an example (WARNING: tries to open a window on page load, so a popup blocker might block it). http://jsfiddle.net/Chakra/mxf2P/1/
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…