# Detecting IE for my style sheet

**URL:** <https://www.ruby-forum.com/t/detecting-ie-for-my-style-sheet/144422>\
**Category:** Rails\
**Created:** [July 29, 2008, 3:38pm UTC](https://www.ruby-forum.com/t/detecting-ie-for-my-style-sheet/144422 "2008-07-29T15:38:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [July 29, 2008, 3:38pm UTC](https://www.ruby-forum.com/t/detecting-ie-for-my-style-sheet/144422/1 "2008-07-29T15:38:49Z")

</div>

I have a two style sheets. One for IE and one for all the other  
browsers.

Now I need browser detection so I know which style sheet to load.

I understand that there is request.user\_agent.

My question is what is the string I need to test for?

Thanks for your time in advance,

Mitch

---

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [July 29, 2008, 5:16pm UTC](https://www.ruby-forum.com/t/detecting-ie-for-my-style-sheet/144422/2 "2008-07-29T17:16:42Z")

</div>

Why not simply use an HTML conditional statement such as:

I haven’t used this before, though TextMate has it built in under  
conditionals within the HTML commands. This one would actually be  
better:

 IE Conditional Comment: NOT Internet Explorer

Let me know if that helps!

~Dustin T.

On Jul 29, 7:38 am, Mitchell G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [July 29, 2008, 5:19pm UTC](https://www.ruby-forum.com/t/detecting-ie-for-my-style-sheet/144422/3 "2008-07-29T17:19:28Z")

</div>

Dustin T. wrote:

> Why not simply use an HTML conditional statement such as:
> 
> I haven’t used this before, though TextMate has it built in under  
> conditionals within the HTML commands. This one would actually be  
> better:
> 
> IE Conditional Comment: NOT Internet Explorer
> 
> Let me know if that helps!
> 
> ~Dustin T.
> 
> On Jul 29, 7:38ï¿½am, Mitchell G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Hey Dustin,  
I was using that and it works fine. However I need to switch to switch  
css pages depending on the browser because I need to change the size of  
the font with css.  
So I was thinking of detecting the browser on the server. Then directing  
to the appropriate css file.  
Have any ideas on this?

Mitch

---

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [July 29, 2008, 5:26pm UTC](https://www.ruby-forum.com/t/detecting-ie-for-my-style-sheet/144422/4 "2008-07-29T17:26:05Z")

</div>

I’m confused… why would conditional comments prevent you from changing  
the  
font size?

Set it in the main style sheet, override it in the IE sheet.

On Tue, Jul 29, 2008 at 10:19 AM, Mitchell G. \<

---

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [July 29, 2008, 5:55pm UTC](https://www.ruby-forum.com/t/detecting-ie-for-my-style-sheet/144422/5 "2008-07-29T17:55:44Z")

</div>

Brian H. wrote:

> I’m confused… why would conditional comments prevent you from changing  
> the  
> font size?
> 
> Set it in the main style sheet, override it in the IE sheet.
> 
> On Tue, Jul 29, 2008 at 10:19 AM, Mitchell G. \<

Thanks I just realized that. I know what to do.

Thanks for that. Cheers,

Mitch

---

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [July 29, 2008, 7:30pm UTC](https://www.ruby-forum.com/t/detecting-ie-for-my-style-sheet/144422/6 "2008-07-29T19:30:56Z")

</div>

Bill W. wrote:

> Hi Mitch,
> 
> Mitchell G. wrote:
> 
> > I have a two style sheets. One for IE and one  
> > for all the other browsers.
> > 
> > Now I need browser detection so I know which  
> > style sheet to load.
> > 
> > I understand that there is request.user\_agent.
> > 
> > My question is what is the string I need to test for?
> 
> This thread should help.
> 
> [http://lists.rubyonrails.org/pipermail/rails/2006-April/032625.html](http://lists.rubyonrails.org/pipermail/rails/2006-April/032625.html)
> 
> Best regards,  
> Bill

Thanks Bill that will come in handy,

Mitch

---

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [July 29, 2008, 6:12pm UTC](https://www.ruby-forum.com/t/detecting-ie-for-my-style-sheet/144422/7 "2008-07-29T18:12:22Z")

</div>

Hi Mitch,

Mitchell G. wrote:

> I have a two style sheets. One for IE and one  
> for all the other browsers.
> 
> Now I need browser detection so I know which  
> style sheet to load.
> 
> I understand that there is request.user\_agent.
> 
> My question is what is the string I need to test for?

This thread should help.

[http://lists.rubyonrails.org/pipermail/rails/2006-April/032625.html](http://lists.rubyonrails.org/pipermail/rails/2006-April/032625.html)

Best regards,  
Bill
