From 95e0e76e3868818471201a67ae2fde404fdb2d9b Mon Sep 17 00:00:00 2001 From: Juho Nurminen Date: Fri, 21 Feb 2014 15:19:47 +0200 Subject: [PATCH] Added a window.prompt polyfill for Metro IE (#13367) Makes metro versions of IE suggest switching to the desktop when window.prompt is called Change-Id: If794631b0fa633aac3572f241374ea8883671c85 --- .../client/ApplicationConfiguration.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/client/src/com/vaadin/client/ApplicationConfiguration.java b/client/src/com/vaadin/client/ApplicationConfiguration.java index 1a5b0d836f..8023c8e50a 100644 --- a/client/src/com/vaadin/client/ApplicationConfiguration.java +++ b/client/src/com/vaadin/client/ApplicationConfiguration.java @@ -605,6 +605,11 @@ public class ApplicationConfiguration implements EntryPoint { enableIOS6castFix(); } + // Enable IE prompt fix (#13367) + if (browserInfo.isIE() && browserInfo.getBrowserMajorVersion() >= 10) { + enableIEPromptFix(); + } + // Prepare the debugging window if (isDebugMode()) { /* @@ -681,6 +686,25 @@ public class ApplicationConfiguration implements EntryPoint { Math.min = function(a,b) {return (a < b === 1 < 2)? a : b} }-*/; + /** + * Make Metro versions of IE suggest switching to the desktop when + * window.prompt is called. + */ + private static native void enableIEPromptFix() + /*-{ + var prompt = $wnd.prompt; + $wnd.prompt = function () { + var result = prompt.apply($wnd, Array.prototype.slice.call(arguments)); + if (result === undefined) { + // force the browser to suggest desktop mode + showModalDialog(); + return null; + } else { + return result; + } + }; + }-*/; + /** * Registers that callback that the bootstrap javascript uses to start * applications once the widgetset is loaded and all required information is -- 2.39.5