jquery-archive / jquery-mobile

jQuery Mobile Framework
https://jquerymobile.com
Other
9.68k stars 2.4k forks source link

2x Back / 1x Forward in Android Browser Not Working After Beta 2 #2890

Closed brettadler closed 13 years ago

brettadler commented 13 years ago

Summary: From the main page of my jQuery Mobile based website, I click on two successive links, then click back twice, then click on a different page. It shows the page, but then the “Loading” pop-up appears for a few seconds and then it automatically goes back to the previous page. If I then hit refresh on the browser it goes to the page I intended it to go to.

Versions : This problem only seems to be happening on the native browser for Android phones. It is not happening on an iPhone, on my PC's Firefox or Chrome browsers, on my Mac's Safari browser or with the Dolphin browser on my Android. I have confirmed it on two different Android phones. My phone is a Droid Incredible 2 running Android version 2.3.4.

Also, it only happens when I run a release later than Beta 2. This issue doesn't happen when I'm running Beta 2. On Beta 3 it locks up at the "loading" message and doesn't go back to the previous screen. The example below is running on 1.0RC2.

Note: This may very well be my fault....meaning I just need to change my code...but since it only happens after Beta 2, I figure something has changed in the framework to cause it to happen. If I make no other changes in my code but just switch to Beta 2, the problem goes away.

Steps to Replicate: Here are the steps to create the issue (needs to be on the native browser on an Android phone):

  1. Click on “By Category”
  2. Click on “Boise Weekly”
  3. Using the back button on your phone, go back twice (to the main page)
  4. Click on “Green Expo June 2012”
  5. THE ERROR: It shows the page, but then the “Loading” pop-up appears for a few seconds and then it automatically goes back to the previous page.

Here is the link to the site having the issue: http://beaconguides.com/test/guide.php?guide=62

And here is a link to the same site but running on Beta 2. http://beaconguides.com/guides/guide.php?guide=62

Can anyone help?? Thanks!!!

toddparker commented 13 years ago

I just tested our demos in Android 2.1 by going forward 2+ steps, then back 2 steps, then forward and things seem to be working so you may need to check your code. Test here: jquerymobile.com/test/

If you can narrow this down to a real issue on jQM, please post a test page using the latest. Template here: http://jsbin.com/arovuz/edit

brettadler commented 13 years ago

Todd,

Thanks for the quick reply!

I agree that it's probably related to my code since I don't see the issue on the test site either.

But....I'm also fairly certain it has to do with something that changed after Beta 2 since it doesn't happen on Beta 2 and it changes behaviors between Beta 3 and the releases. Can you, or anyone, give me some insight into what might have changed from Beta 2 that could be causing my code to have issues? Even just some guidance on what to look for would be helpful.

I am actually building about a dozen sites right now on jQuery Mobile that I'd like to upgrade before their release but I can't upgrade until I get this one issue figured out.

Thanks! Brett

toddparker commented 13 years ago

We added pushState support at some point around then (may have been RC?) so that's worth looking at. Lots of changes!

brettadler commented 13 years ago

Yeah, I think that was around Beta 3...so I will take a look at the documentation regarding it. Thanks!

brettadler commented 13 years ago

THANK YOU!!!! It was the pushState change. As soon as I disabled pushState the problem went away.

Based on the documentation below for pushState, it seems the fault is with how Android's native browser implements pushState combined with the way I'm linking my documents (lots of rel="external" and use of the same file to render different content based on what parameters are passed through). I will just keep it disabled for now.

http://jquerymobile.com/test/docs/pages/page-navmodel.html

Thank you again!

toddparker commented 13 years ago

Glad this was a helpful tip, sorry pushState is so wonky in some of these browsers.