# Format.js in IE6

**URL:** <https://www.ruby-forum.com/t/format-js-in-ie6/149294>\
**Category:** Rails\
**Created:** [September 23, 2008, 10:57am UTC](https://www.ruby-forum.com/t/format-js-in-ie6/149294 "2008-09-23T10:57:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [September 23, 2008, 10:57am UTC](https://www.ruby-forum.com/t/format-js-in-ie6/149294/1 "2008-09-23T10:57:02Z")

</div>

Hi  
I have the code

@service\_desk\_resolution=ServiceDeskResolution.find @sd\_resolution\_id  
@sd\_resolv=ServiceDeskResolutionEffort.new  
@ret\_val=@sd\_resolv.checkdata(@sd\_effort)  
error\_value=0  
respond\_to do |format|  
@error\_message=’’  
@ret\_val.each do |val|  
if val==‘nonnumeric’  
@error\_message=@error\_message+’  
’+‘Please enter the numeric  
value for effort.’+’  
’  
error\_value=1  
end  
end  
if @sd\_ticket.service\_desk\_cis.empty?  
@error\_message=@error\_message+’  
’+‘No associated  
CIs.’+’  
’  
error\_value=1  
end  
if error\_value==1  
format.js do  
#here get IE6 problem  
puts ‘in format.js’  
render :action =\> ‘sd\_resolution\_range\_nonnumeric\_ci\_check.rjs’  
end  
format.html do  
puts ‘in error else part format.html’  
flash[:notice]=@error\_message  
redirect\_to :action =\> ‘define\_sd\_resolution\_ui’,:id =\>  
params[:id]  
end

```
  And I am calling the same from both ajax and normal way(ie link_to

```

and link\_to\_remote)…It is working properly in Firefox…But when I  
checked in IE6 what happens is if the clicked link is link\_to then also  
it ennters to format.js instaed of format.html And I can’t figure out  
why this happens in IE6.Please help

Thanks in advance  
Sijo

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [September 23, 2008, 12:13pm UTC](https://www.ruby-forum.com/t/format-js-in-ie6/149294/2 "2008-09-23T12:13:45Z")

</div>

Hi  
I could solve the problem by just rearranged format.html first and  
then format.js… But still my doubt remains. Was that created the  
problem ?Is it a must to write format.html first?

Sijo

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [September 23, 2008, 2:20pm UTC](https://www.ruby-forum.com/t/format-js-in-ie6/149294/3 "2008-09-23T14:20:26Z")

</div>

On Tue, Sep 23, 2008 at 6:13 AM, Sijo Kg  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)wrote:

> I could solve the problem by just rearranged format.html first and  
> then format.js… But still my doubt remains. Was that created the  
> problem ?Is it a must to write format.html first?

Yes, format.html must be first. The reason is that Rails uses the HTTP  
“Accepts” header to determine the content type that the browser is  
asking  
for. Along with reasonable things like “text/html”, IE6 includes “_/_”,  
telling Rails that it will take anything. Rails will server up the  
first  
response format that matches, so it’ll give the first one.

Gross, isn’t it? Imagine the day when we won’t have to worry about IE6.  
_seeing visions of sitting in a hammock on the ocean_

Brandon

## –

Sessions by Collective Idea: Ruby on Rails training in a vacation  
setting  
[http://sessions.collectiveidea.com](http://sessions.collectiveidea.com)
