Permalink
Browse files

adding more robust determination for wether pushState is available or…

… not
  • Loading branch information...
catshirt authored and defunkt committed Jun 29, 2011
1 parent a7ad479 commit bb5ba4962519a5433bb49c14a87e8bf4da67d4ea
Showing with 11 additions and 1 deletion.
  1. +11 −1 jquery.pjax.js
View
@@ -220,7 +220,17 @@ if ( $.inArray('state', $.event.props) < 0 )
// Is pjax supported by this browser?
-$.support.pjax = window.history && window.history.pushState
+// http://stackoverflow.com/questions/6161701/is-history-api-broken-on-ios-location-bar-doesnt-update-on-pushstate
+// pushState enabling determination stolen from https://github.com/balupton/history.js
+$.support.pjax = Boolean(
+ window.history && window.history.pushState && window.history.replaceState
+ && !(
+ /* disable for versions of iOS before version 4.3 (8F190) */
+ (/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent)
+ /* disable for the mercury iOS browser, or at least older versions of the webkit engine */
+ || (/AppleWebKit\/5([0-2]|3[0-2])/i).test(navigator.userAgent)
+ )
+);
// Fall back to normalcy for older browsers.

0 comments on commit bb5ba49

Please sign in to comment.