Im making a mobile optimised website that has fullscreen dialog windows that open when you ‘click’ certain elements on the page. These windows are actually just divs that are animated into position.
If the user presses the browser back button when one of these dialoge windows is open I want the dialoge box to close, not for the page to be left all together.
I can do this with iPhone. If I make the element you click a link fragment, then on the window.onpopstate event I can use window.location.href to check the url and hide the dialoge box if appropriate.
However I cant get this to work on Android as window.onpopstate isn’t supported (at least with the phone im testing with which is quite old). How can I get round this? jQuery Mobile can do this, so I know it must be possible somehow.
Thanks
I havnt looked extensibly into the level of support of this, but window.onhashchange works for my pretty old Android.