JDevine
2008-Jul-24 04:37 UTC
respond_to wrong in ie -- html requests seen as text/javascript
Anyone come across this problem?
It may be something I''m doing somewhere, but my page renders fine in
Firefox, and returns a syntax error in Internet explorer.
Very strange, I thought, then I traced it to the fact that the IE
request is responding to format.js while the firefox request is
responding to format.html:
<code>
def index_response
respond_to do |format|
format.js {
puts("was js")
if (params[:search] && params[:search][:current])
puts("search current")
render :template=>"models/association_page.rjs"
else
puts("rendering div partial")
render :partial=>''div'',:collection=>@objects,
:locals=>{:pa=>@pa,
:parent_object=>@parent_object,
:editable=>params[:editable]
}
end
}
format.html {
puts("was html")
if @exact_objects.size == 1 && @objects.empty?
@object = @exact_objects.to_a.first
redirect_to :action=>''show'', :id=>@object.id
elsif @exact_objects.empty? && @objects.empty? &&
logged_in?
redirect_to({:action=>"new"}.merge(search_params_into_params))
end
}
end
</code>
for the IE request, it logs:
"was js"
"rendering div partial".
while the firefox request logs
"was html"
Any ideas what could cause this?
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---
JDevine
2008-Jul-24 04:44 UTC
Re: respond_to wrong in ie -- html requests seen as text/javascript
Never mind -- I didn''t realize a page could respond to different mime types, and the Responder would respond to the first one that works, so I switched the order and that works. On Jul 23, 11:37 pm, JDevine <johnjdev...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Anyone come across this problem? > > It may be something I''m doing somewhere, but my page renders fine in > Firefox, and returns a syntax error in Internet explorer. > > Very strange, I thought, then I traced it to the fact that the IE > request is responding to format.js while the firefox request is > responding to format.html: > > <code> > def index_response > respond_to do |format| > format.js { > puts("was js") > if (params[:search] && params[:search][:current]) > puts("search current") > render :template=>"models/association_page.rjs" > else > puts("rendering div partial") > render :partial=>''div'',:collection=>@objects, > :locals=>{:pa=>@pa, > :parent_object=>@parent_object, > :editable=>params[:editable] > } > end > } > format.html { > puts("was html") > if @exact_objects.size == 1 && @objects.empty? > @object = @exact_objects.to_a.first > redirect_to :action=>''show'', :id=>@object.id > elsif @exact_objects.empty? && @objects.empty? && logged_in? > > redirect_to({:action=>"new"}.merge(search_params_into_params)) > end > } > end > </code> > > for the IE request, it logs: > "was js" > "rendering div partial". > > while the firefox request logs > "was html" > > Any ideas what could cause this?--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---