all!
I'm having an issue with parent/child window communication on the stock Android 'Browser' browser. Safari, Chrome, Firefox, IE(!!!), iOS, all good! Android v4.1.1, not so much.
The flow:
- From the parent, I open a child window, and add a loop to listen for the child window to close.
- Child window closes, parent is notified.
- Parent clears the loop, calls the handler.
Easy, right?
The problem: Android can call the window.close()
from the child, but the parent is unaware of the close event, ie, step 3 never happens. Perhaps javascript is suspended in the parent while a child window is opened? Javascript is indeed running in the parent window. Is there a definitive fix or workaround for this problem?
My CoffeeScript:
openTwitterAuthWindow: (authURL) =>
@twitterWindow = window.open(authURL, "_blank", "width=550,height=420")
@checkInterval = window.setInterval(@checkChildWindow, 500)
checkChildWindow: () =>
if (@twitterWindow && @twitterWindow.closed)
alert("Excelsior!") # <-- Not called, unfortunately
window.clearInterval(@checkInterval)
@twGetLoginStatus()
Only javascript inside the child window:
<script type="text/javascript">
window.close();
</script>
Thanks in advance!