The problem you're both having is that Internet Explorer sends a
ludicrous Accept header in a few situations. From memory it's things
like:
# The flash plugin requesting the url
# Opening the page in a new window
etc.
The header says "I consider xml, html, javascript, word documents and
anything else as equal" and in those situations rails will send your
first format to break a tie.
I personally would strongly recommend disabling the accept header,
otherwise your site becomes unusable once you have a public website
with dozens of IE users each with a different permutation of browser
helpers.
On Apr 16, 1:17 pm, Jeremy Olliver <
jeremy.olli...@gmail.com> wrote:
> I've had a problem with this before, and the fix for me was to ensure the
> html response was declared before the js response.
>
> eg.
>
> # Incorrectly displays JS when should be redirecting
> responds_to do |format|
> format.js { render :action => 'update' }
> format.html { redirect_to :action => 'show' }
> end
>
> # Works correctly
> responds_to do |format|
> format.html { redirect_to :action => 'show' }
> format.js { render :action => 'update' }
> end
>
> Not sure if this will help out in your case, but it worked for me.
>
> Cheers,
> Jeremy
>
> On 16 April 2010 12:43, ptorrsmith <
ptorrsm...@gmail.com> wrote:
>
>
>
>
>
> > We've bumped into this on a job, where IE accept headers say they
> > respond to anything, so it responds to the first call in the
> > respond_to block.
>
> > Saw Koz put a fix in ages ago but it was retracted shortly after
> > (
http://github.com/rails/rails/commit/
> > 2f4aaed7b3feb3be787a316fab3144c06bb21a27)
>
> > So we have manually put the following
>
> > config.action_controller.use_accept_header = false
>
> > in the config/environment.rb (thanks to
> >
http://paul.stadig.name/2009/02/rails-respondto-ie6-and-accept-header...
> > )
>
> > We use formatted urls (e.g. /people/1.js) to support non html calls,
> > so feel safe using this approach.
>
> > Anyone know of any problems with doing this?
>
> > Seems like both a bug in IE and a problem with respond_to, with
> > neither wanting to budge? :-)
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "WellRailed" group.
> > To post to this group, send email to
wellr...@googlegroups.com.
> > To unsubscribe from this group, send email to
> >
wellrailed+...@googlegroups.com<wellrailed%2Bunsubscribe@googlegrou
ps.com>
> > .