Added a specific check for 'iPhone' in the user-agent string, which treats it specifically as 'new' for purposes of history implementation. It also updates the user-agent version check to look for " AppleWebKit/..." instead of just "WebKit/...", per apple's specs.
Issue: 1509
Patch by: jgw
Review by: bobv
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@1329 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/impl/HistoryImplSafari.java b/user/src/com/google/gwt/user/client/impl/HistoryImplSafari.java
index a95c793..b4f4497 100644
--- a/user/src/com/google/gwt/user/client/impl/HistoryImplSafari.java
+++ b/user/src/com/google/gwt/user/client/impl/HistoryImplSafari.java
@@ -24,7 +24,7 @@
private static boolean isOldSafari = detectOldSafari();
private static native boolean detectOldSafari() /*-{
- var exp = /WebKit\/([\d]+)/;
+ var exp = / AppleWebKit\/([\d]+)/;
var result = exp.exec(navigator.userAgent);
if (result) {
// The standard history implementation works fine on WebKit >= 522
@@ -34,6 +34,12 @@
}
}
+ // The standard history implementation works just fine on the iPhone, which
+ // unfortunately reports itself as WebKit/420+.
+ if (navigator.userAgent.indexOf('iPhone') != -1) {
+ return false;
+ }
+
return true;
}-*/;