When an error occurs during handling a request, I redirect to a special controller for error messages. For XML HTTP request I noticed that Firefox (1.0.7) does not set the X-Requested-With header to XMLHttpRequest on the second, redirected request. Konqueror (3.5.2), the only other browser I''ve checked, does add the header as expected. I''m working around this by adding an additional param to the redirect_to that indicates that it is meant to be handled as an XHR even though request.xhr? is not true. Now I''m wondering whether there''s anything wrong with redirecting XHRs or if it''s just a bug in that version of Firefox. Michael -- Michael Schuerig mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org http://www.schuerig.de/michael/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Michael Schuerig wrote:> When an error occurs during handling a request, I redirect to a special > controller for error messages. For XML HTTP request I noticed that > Firefox (1.0.7) does not set the X-Requested-With header to > XMLHttpRequest on the second, redirected request. Konqueror (3.5.2), > the only other browser I''ve checked, does add the header as expected. > > I''m working around this by adding an additional param to the redirect_to > that indicates that it is meant to be handled as an XHR even though > request.xhr? is not true. > > Now I''m wondering whether there''s anything wrong with redirecting XHRs > or if it''s just a bug in that version of Firefox. > > Michael > > -- > Michael Schuerig > mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org > http://www.schuerig.de/michael/Instead of doing a hard redirect just redirect via rjs def foo raise ''big nasty error!'' rescue render(:update) { |page| page.redirect_to error_page_url } end Or embed that rescue in a respond_to block to support non-js as well. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---