0

my app use appcache, when trigger history.back() in safari(Ios7), it dose not work. After remove appcache minifest, it works, I can console in 'statechange'.

0hao
  • 3
  • 2

2 Answers2

0

This is due to a bug in Safari 7+ when using AppCache. Only known solution at this point is disabling AppCache.

See history.back() doesn't work in Safari on iOS

Community
  • 1
  • 1
  • This iOS7 Safari bug appears to have been fixed in iOS 7.1.2, which is rolling out at the moment. It just became available for my iPad and iPhone, and it has solved the back navigation problem for my offline cached app. – Chris Denning Jul 06 '14 at 15:40
0

it is a terrible bug! I use this fix:

if (
    (/\bSafari\//gi).test(window.navigator.userAgent) &&
    (/\bVersion\/7/gi).test(window.navigator.userAgent)
) {
    window.console.warn('removing appcache');
    window.document.documentElement.removeAttribute('manifest');
}

I have some reports of back buttons still not working after this fix, but everywhere I tested it does work. I hope this helps!

Elmer
  • 9,147
  • 2
  • 48
  • 38