diff options
-rw-r--r-- | WebContent/VAADIN/vaadinBootstrap.js | 16 | ||||
-rw-r--r-- | client/src/com/vaadin/client/BrowserInfo.java | 7 |
2 files changed, 21 insertions, 2 deletions
diff --git a/WebContent/VAADIN/vaadinBootstrap.js b/WebContent/VAADIN/vaadinBootstrap.js index 9e012ae987..f5c00a0b65 100644 --- a/WebContent/VAADIN/vaadinBootstrap.js +++ b/WebContent/VAADIN/vaadinBootstrap.js @@ -269,8 +269,20 @@ } // Detect touch device support - try { document.createEvent("TouchEvent"); url += "&v-td=1";} catch(e){}; - + var supportsTouch = false; + try { + document.createEvent("TouchEvent"); + supportsTouch = true; + } catch (e) { + // Chrome and IE10 touch detection + supportsTouch = 'ontouchstart' in window + || navigator.msMaxTouchPoints; + } + + if (supportsTouch) { + url += "&v-td=1"; + } + return url; } }; diff --git a/client/src/com/vaadin/client/BrowserInfo.java b/client/src/com/vaadin/client/BrowserInfo.java index f0a4ccde0a..bddeddf74c 100644 --- a/client/src/com/vaadin/client/BrowserInfo.java +++ b/client/src/com/vaadin/client/BrowserInfo.java @@ -85,6 +85,8 @@ public class BrowserInfo { if (browserDetails.isChrome()) { touchDevice = detectChromeTouchDevice(); + } else if (browserDetails.isIE()) { + touchDevice = detectIETouchDevice(); } else { touchDevice = detectTouchDevice(); } @@ -100,6 +102,11 @@ public class BrowserInfo { return ("ontouchstart" in window); }-*/; + private native boolean detectIETouchDevice() + /*-{ + return !!navigator.msMaxTouchPoints; + }-*/; + private native int getIEDocumentMode() /*-{ var mode = $wnd.document.documentMode; |