Go Back   Free website templates > Web Template Help > HTML - XHTML - CSS
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Join now to share free website templates or post on the forum. If you have never been on a forum before read the FAQ. It's quick, easy and free to join!
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-16-2007, 06:20 AM
Junior Member
 
Join Date: Apr 2007
Posts: 2
bohica032 is on a distinguished road
Default IE vs FF and others.

Good Day to all.

Here is a piece of code that my be helpfull to some. This code determines if your visitor is using IE or FF and others. At the same time it will determine which CSS file to attach to your pages. This way you can create 2 css files, one specific to IE only and other that works the best for FF and other browsers.

I hope it will work for you.
Code:
<script language="JavaScript">
<!--
browser_version= parseInt(navigator.appVersion);
browser_type = navigator.appName;
 
if (browser_type == "Microsoft Internet Explorer" && (browser_version >= 4)) {
document.write("<link rel='stylesheet' type='text/css' href='css/main_IE.css' />");
}
 
else {
document.write("<link REL='stylesheet' HREF='css/main.css' TYPE='text/css' />");
}
// --></script>
Reply With Quote
  #2 (permalink)  
Old 04-16-2007, 06:42 AM
Senior Member
 
Join Date: May 2006
Location: Australia
Posts: 592
Scoooooty is on a distinguished road
Default

Nice script
Reply With Quote
  #3 (permalink)  
Old 04-16-2007, 10:31 PM
Senior Member
 
Join Date: Mar 2007
Location: Florida
Posts: 121
solemage is on a distinguished road
Send a message via AIM to solemage Send a message via MSN to solemage
Default

Nice job, I might use this.
Reply With Quote
  #4 (permalink)  
Old 09-29-2007, 10:19 PM
Junior Member
 
Join Date: Sep 2007
Posts: 12
kalnera is on a distinguished road
Default

HTML Code:
<script language="JavaScript">
<!--
browser_version= parseInt(navigator.appVersion);
browser_type = navigator.appName;
 
if (browser_type == "Microsoft Internet Explorer" && (browser_version >= 4)) {
document.write("<link rel='stylesheet' type='text/css' href='css/main_IE.css' />");
}
else if (browser_type == "Mozila firefox" && (browser_version >= 4)) {
document.write("<link rel='stylesheet' type='text/css' href='css/main_mf.css' />");
} 
 
else {
document.write("<link REL='stylesheet' HREF='css/main.css' TYPE='text/css' />");
}
// --></script>
would this be proper code for taking into consideration firefox also? I am not sure what is the name to call for firefox so... . I am having troulbe with different look on IE and opera while look on firefox is good
Reply With Quote
  #5 (permalink)  
Old 10-02-2007, 04:40 PM
Anders Moen's Avatar
Junior Member
 
Join Date: Oct 2007
Location: Norway
Posts: 4
Anders Moen is on a distinguished road
Default

bohica032:
And this would be if a user has disabled JS?

It's better to use PHP (if you use PHP as server-side language on your site) to check what browser users is using
Reply With Quote
  #6 (permalink)  
Old 10-07-2007, 01:39 PM
Junior Member
 
Join Date: Oct 2007
Posts: 11
unixanalyst is on a distinguished road
Default

Looky looky what I found...

Conditional comments, read only by IE to solve this just problem:

<!--[if IE]>
<link href="iestyle.css" rel="stylesheet" type="text/css" media="screen" />
<![endif]-->

Works for MSIE5.5+
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:33 AM.



mouseover mouseover mouseover