]> source.dussan.org Git - vaadin-framework.git/commitdiff
#6336 IE8 in compatibility mode does not work
authorArtur Signell <artur.signell@itmill.com>
Tue, 8 Feb 2011 15:33:38 +0000 (15:33 +0000)
committerArtur Signell <artur.signell@itmill.com>
Tue, 8 Feb 2011 15:33:38 +0000 (15:33 +0000)
svn changeset:17226/svn branch:6.5

src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java

index bf3ba8f759ea42f1554daf9424ee7b992b1662be..c1df8cb40d320085cfdea2911905028e01376b7f 100644 (file)
@@ -1622,9 +1622,9 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
 
         if (!fragment) {
             setAjaxPageHeaders(response);
-            writeAjaxPageHtmlHeadStart(page);
-            writeAjaxPageHtmlHeader(page, title, themeUri);
-            writeAjaxPageHtmlBodyStart(page);
+            writeAjaxPageHtmlHeadStart(page, request);
+            writeAjaxPageHtmlHeader(page, title, themeUri, request);
+            writeAjaxPageHtmlBodyStart(page, request);
         }
 
         String appId = appUrl;
@@ -1913,10 +1913,11 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
      * Override this method if you want to add some custom html to the page.
      * 
      * @param page
+     * @param request
      * @throws IOException
      */
-    protected void writeAjaxPageHtmlBodyStart(final BufferedWriter page)
-            throws IOException {
+    protected void writeAjaxPageHtmlBodyStart(final BufferedWriter page,
+            final HttpServletRequest request) throws IOException {
         page.write("\n</head>\n<body scroll=\"auto\" class=\""
                 + ApplicationConnection.GENERATED_BODY_CLASSNAME + "\">\n");
     }
@@ -1930,15 +1931,26 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
      * @param page
      * @param title
      * @param themeUri
+     * @param request
      * @throws IOException
      */
     protected void writeAjaxPageHtmlHeader(final BufferedWriter page,
-            String title, String themeUri) throws IOException {
+            String title, String themeUri, final HttpServletRequest request)
+            throws IOException {
         page.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n");
 
-        // Force IE9 into IE8 mode. Remove when IE 9 mode works (#5546), chrome
-        // frame if available #5261
-        page.write("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=8,chrome=1\"/>\n");
+        WebBrowser browser = getApplicationContext(request.getSession())
+                .getBrowser();
+        if (browser.isIE()) {
+            // Chrome frame in all versions of IE (only if Chrome frame is
+            // installed)
+            if (browser.getBrowserMajorVersion() == 9) {
+                // Force IE9 into IE8 mode. Remove when IE 9 mode works (#5546)
+                page.write("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=8,chrome=1\"/>\n");
+            } else {
+                page.write("<meta http-equiv=\"X-UA-Compatible\" content=\"chrome=1\"/>\n");
+            }
+        }
 
         page.write("<style type=\"text/css\">"
                 + "html, body {height:100%;margin:0;}</style>");
@@ -1962,10 +1974,11 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
      * beginning of the page.
      * 
      * @param page
+     * @param request
      * @throws IOException
      */
-    protected void writeAjaxPageHtmlHeadStart(final BufferedWriter page)
-            throws IOException {
+    protected void writeAjaxPageHtmlHeadStart(final BufferedWriter page,
+            final HttpServletRequest request) throws IOException {
         // write html header
         page.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD "
                 + "XHTML 1.0 Transitional//EN\" "