JQuery back button broke using cordova after ios 9 update

Recently an application I have been working on was ready for the App Store , but then came an iOS update and all of a sudden things went wrong. (big BOOOOO)

Android device still working so I knew it wasn’t the code base. The application had already been tested on iOS devices and was fine. I did a bit of googling and found a few people moaning about the iOS 9 update.

I had strange behavior where the back button wouldn’t work and also sometime the back button would take me to a different page that was unrelated to the state in the navigation history , uh!.

Ok so the simple fix is to add the following two lines.


$.mobile.hashListeningEnabled=false;
$.mobile.pushStateEnabled = false;

Reference for the solution (combo of the two)

http://stackoverflow.com/questions/32820224/jquery-cordova-history-issue-ios-9-history-broken
https://forum.jquery.com/topic/page-navigation-issues-under-ios9-beta

You can add some logic to determine when to put this in for iOS but I simple added a merge file specifc for apple as the settings shouldn’t be changed for Android as that doesnt have the issue.

Happy Bug Fighting!

Cheers

Neil

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s