# Respond\_to wrong in ie -- html requests seen as text/javascript

**URL:** <https://www.ruby-forum.com/t/respond-to-wrong-in-ie-html-requests-seen-as-text-javascript/143958>\
**Category:** Rails\
**Created:** [July 24, 2008, 6:38am UTC](https://www.ruby-forum.com/t/respond-to-wrong-in-ie-html-requests-seen-as-text-javascript/143958 "2008-07-24T06:38:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdevine](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@jdevine](https://www.ruby-forum.com/u/jdevine)\
**Post date:** [July 24, 2008, 6:38am UTC](https://www.ruby-forum.com/t/respond-to-wrong-in-ie-html-requests-seen-as-text-javascript/143958/1 "2008-07-24T06:38:08Z")

</div>

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:

`
  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
`

for the IE request, it logs:  
“was js”  
“rendering div partial”.

while the firefox request logs  
“was html”

Any ideas what could cause this?

---

<div class="post-metadata">

**Author:** ![jdevine](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@jdevine](https://www.ruby-forum.com/u/jdevine)\
**Post date:** [July 24, 2008, 6:45am UTC](https://www.ruby-forum.com/t/respond-to-wrong-in-ie-html-requests-seen-as-text-javascript/143958/2 "2008-07-24T06:45:09Z")

</div>

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.
