Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Opening history ignored in iPhone homescreen webapp #3729

Closed
adriancd opened this issue Mar 3, 2012 · 8 comments
Closed

Opening history ignored in iPhone homescreen webapp #3729

adriancd opened this issue Mar 3, 2012 · 8 comments

Comments

@adriancd
Copy link

adriancd commented Mar 3, 2012

I have a webapp which stores the users data as they progress so that if they click on an external link while in the homescreen app mode on an iphone and leave the app to view a webpage or similar, when they return the webapp will resume at the same position

When the web app reopens, it checks the local storage and calls 2 or 3 pages instantly. This works fine but the back button in homescreen webapp mode will appear and nothing happens when clicked. I can start clicking through pages in the webapp and then the back button will work but the rapidly generated pages at the beginning are ignored

To list the steps:

Homescreen iphone webapp opens
onload called
js checks local storage and creates landing page then 1 or 2 pages immediately using $.mobile.changePage ()
pages are correctly created but user cannot use back button to go back

If the webapp is used in normal safari mode then the back button navigates correctly through these auto generated pages at the start so the problem is only in homescreen mode

I am using 1.0.1 and latest iphone

I have done more tests by listening to the hashchange event. If the app pushes through 2 pages on opening the window.location.hash only changes once in both safari and homescreen mode. but in safari the back button will work and take the user to the previous page

@adriancd
Copy link
Author

adriancd commented Mar 4, 2012

I have managed to work around this. By using a 20ms delay between each automated page request on the app launching, the history in iphone homescreen mode will update but the home page is still ignored. I can only go back as far as the second automated page but i can measure the window.history.length and add a click event to the back button on the second page to open the homepage instead of going back in history.

This works quite acceptably apart from seeing a momentary glimpse of each automated page request as it is pushed into the history.

A system to push pages rapidly into the history on app launch would be really useful for when you need to return the user to a page in the app

I am using a multi-page template

Thanks

@jakeboone02
Copy link
Contributor

I'm not certain, but I think this may be related to #3190.

@johnbender
Copy link
Contributor

@adriancd

If you could post a sample it would be helpful for seeing the sequence of the callbacks. It doesn't have to use local storage, I'd imagine you could just attempt to load an arbitrary page early in the the even cycle and get the same results (which is, I assume, why @jakeboone02 referenced #3190)

@adriancd
Copy link
Author

It was a very complex app so hard to bring down to a basic level but I have noticed in another JQM project that the first page of the site does not register in the history if javascript is automatically pushing the user onto another page, and this was after a short delay. This happened in Safari/iPhone but not Safari/Mac. Will be looking at this again soon so will try to get an example

Thanks

@agcolom
Copy link
Contributor

agcolom commented May 23, 2012

@adriancd Are you still experiencing this with 1.1.0 or latest? Thanks

@adriancd
Copy link
Author

Not been working on the app which had this issue so I can't test. Will report if it comes up again. Thanks

@reedling78
Copy link

I have the same issue in 1.1.1 it only happens in FireFox.

@jaspermdegroot
Copy link
Contributor

Closing this issue because @adriancd hasn't reported it came up again.

@reedling78 - If you still have a problem on Firefox, can you open a new ticket and include a test page. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants