Monday, October 6, 2014

window.open in JavaScript seems to replace the current window in JavaScript at a web clip instead of actually opening a new window!

Curiously, if you look at what is in window.opener.name from the window you opened it will be the name you gave to the second window from its "parent" and not undefined. window.opener.someMethodOnTheParentPage will however be undefined in this circumstance when window.opener.someMethodOnTheParentPage might otherwise be legitimate at the parent page. closeChildWindow (in a prior blog posting) would be an example of a method hanging off of window.opener that would only exist at the parent page. The fact that there is a window.opener whatsoever suggests that whenever you open a new window in a web clip that you are just replacing the existing window with the new window and not staging some circumstance in which a new window is sitting over top of the old window and hiding it completely. I have observed these behaviors at an iPad, yet in Safari at the same iPad window.open just opens the new window in a new tab instead of replacing the existing tab with new contents. Two very different behaviors occur contrasting the regular Safari experience to that of the web clip.

No comments:

Post a Comment