myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Cooper <mcoo...@apache.org>
Subject Re: ViewExpiredException only in some IE8
Date Mon, 13 Jun 2011 21:34:05 GMT
I believe that if you are seeing a different browser mode for "localhost"
vs. "machinename" then this is either coming from the IE compatibility view
preferences where the user has chosen to run pages from a given domain in
compatibility view or the domain is listed in one of Microsoft's xml files
like http://ie9cvlist.ie.microsoft.com/ie9CompatViewList.xml where it will
(by default) try to choose some other document mode for that domain.

Unfortunately, there is no way to force IE version X to also use Browser
Mode X for your web application.  You can't even know what version "X" is
because the user agent header that IE sends to the server changes based on
what Browser Mode is active.

However, it is possible to force IE to use a Document Mode that matches the
currently-assigned Browser Mode if the following were in the
DocumentRenderer:

        // Force IE to use matching "browser mode" (Agent version) and
"document mode" (doctype).
        // IE requires this be the FIRST element in the HEAD tag.
        Agent agent = rc.getAgent();

        if (agent.getAgentName().equals(Agent.AGENT_IE))
        {
          String agentVersion = agent.getAgentVersion();
          float ieVersion;

          try
          {
            ieVersion = Float.parseFloat(agentVersion);
          }
          catch (NumberFormatException e)
          {
            ieVersion = 7.0f;
          }

          out.startElement("meta", null);
          out.writeAttribute("http-equiv" , "X-UA-Compatible", null);
          out.writeAttribute("content" , "IE=" + ieVersion, null);
          out.endElement("meta");
        }

This meta tag might help prevent some of the mismatching mode behaviors; it
is funny how "compatibility view" makes things incompatible :)  Too bad
there isn't a "just use the real behavior for the version of the browser
that is installed" mode, maybe if enough people asked for it, Microsoft
might add such a switch; e.g.:

   - force IE10 to use Document Mode 10 and Browser Mode 10
   - force IE9 to use Document Mode 9 and Browser Mode 9
   - force IE8 to use Document Mode 8 and Browser Mode 8


An extra level of protection could be when running Internet Explorer, take
the ieVersion number as seen above and somehow send it to the browser and
then in JavaScript:

   - if ieVersion is a number less than 8, and
   - if the variable "document.documentMode" is not equal to null

then you are running in compatibility view mode.  When this is detected, you
could then show an alert to the user, asking them to disable compatibility
view.  Perhaps the above meta tag is sufficient on its own--it is worth
testing.

Note that it looks like Microsoft does have a process to get your domain
removed from their compatibility view xml files:
http://msdn.microsoft.com/en-us/library/dd567845(v=vs.85).aspx

Regards,
Matt

On Mon, Jun 13, 2011 at 2:52 PM, Cédric Durmont <cdurmont@gmail.com> wrote:

> Try changing the "compatibility mode" in IE. IE8 "almost always"
> switches to IE7-compatible mode with Trinidad.
> Also, you may get different result if you access your Trinidad app
> with "http://machinename/..." and "http://localhost/...". As strange
> as it sounds, IE has a different behavior when you use "localhost"
> (and this has nothing to do with security parameters... Man I love
> this browser !)
>
> Regards,
> Cedric
>
> 2011/6/10 Walter Mourão <walter.mourao@gmail.com>:
> > Hi Cedric,
> > just tried with tr:setActionListener and I've got the same result... this
> is
> > really a strange problem: IE8 (same 'complete' version) accessing the
> same
> > site, same configuration, etc. Works with one and doesn't work with the
> > other. Continuing the quest...
> >
> > Walter Mourão
> > http://waltermourao.com.br
> > http://arcadian.com.br
> > http://oriens.com.br
> >
> >
> >
> > On Fri, Jun 10, 2011 at 10:02 AM, Cédric Durmont <cdurmont@gmail.com>
> wrote:
> >
> >> Hi Walter,
> >>
> >> The only thing that looks unusual to me in your code is the mix
> >> between tr:commandLink and f:setPropertyActionListener. Have you tried
> >> tr:setActionListener instead ?
> >> (btw I see no reason why this would cause a viewExpiredException on
> >> some browsers, but who said computing was an exact science ?)
> >>
> >> Regards,
> >> Cedric
> >>
> >> 2011/6/10 Walter Mourão <walter.mourao@gmail.com>:
> >> > Hi folks,
> >> > I'm using Myfaces 1.2.9, Trinidad 1.2.14.
> >> > the following commandLink (and others in the same application) causes
> >> > ViewExpiredException in some (!!!) IE8...
> >> >
> >> >        <tr:commandLink id="proximaPagina"
> >> >
> action="#{listarRelatoriosController.visualizandoRelatorioMudarPagina}"
> >> >
> >>
> disabled="#{listarRelatoriosVisualizandoRelatorioMudarPaginaForm.paginaAtual
> >> > ge form.paginas}" partialSubmit="false">
> >> >            <tr:image source="/images/arrow-next.gif"
> >> > shortDesc="#{messages['proxima.pagina']}"
> inlineStyle="border-style:none"
> >> />
> >> >            <f:setPropertyActionListener
> >> >
> value="#{listarRelatoriosVisualizandoRelatorioMudarPaginaForm.paginaAtual
> >> +
> >> > 1}"
> >> >
> >>
> target="#{listarRelatoriosVisualizandoRelatorioMudarPaginaForm.paginaAtual}"
> >> > />
> >> >        </tr:commandLink>
> >> >
> >> > I'm lost... Hints ?
> >> >
> >> > Walter Mourão
> >> > http://waltermourao.com.br
> >> > http://arcadian.com.br
> >> > http://oriens.com.br
> >> >
> >>
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message