472,981 Members | 1,427 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,981 software developers and data experts.

Browser Detection for CSS

I figured i could easily solve my problem if i used a detectin script so a differant CSS could be used for each browser.
So i found this:

Expand|Select|Wrap|Line Numbers
  1. <!-- CSS Browser Detect BEGIN -->
  2. <script language="JavaScript"><!--
  3. browser_version = parseInt(navigator.appVersion);
  4. browser_type = navigator.appName;
  6. if (browser_type == "Microsoft Internet Explorer" && (browser_version >= 4)) {
  7. document.write("<link REL='stylesheet' HREF='CSS/IECSS.css' TYPE='text/css'>");
  9. else if (browser_type == "*Mozilla*" && (browser_version >= 1)) {
  10. document.write("<link REL='stylesheet' HREF='CSS/FFCSS.css' TYPE='text/css'>");
  12. // --></script>
  13. <!-- CSS Browser Detect END -->
(This is slightly edited tho, but only the browser_type)

So, i was trying to get it too detect FireFox, but i cant figure out what the browser type would be for this.

Anyone have any ideas?
Jan 18 '08 #1
4 2523
Nevermind, i may have found a solution for firefox.

Instead of trying to make one specifically for Firefox, i just made a 'else' line.

Now i need help with opera :D
Jan 18 '08 #2
7,435 Expert 4TB
I don't know of any reason to do it this way. If you write your CSS to the W3C standard, the ony browser that may give you problems is IE. Trying to create a different stylesheet for each browser is a waste of time.
Jan 18 '08 #3
But you see, time i have.

This is coursework anyway. And all i do is copy the style sheets and alter them slightly so they look just perfect for each browser.

(And i dont do all browsers, so far ive done Internet Explorer, Netscape - which also does firefox) and Opera)

Anyway. Think ive got it all sorted... kinda :/
Jan 18 '08 #4
7,435 Expert 4TB
Conditional Love
Kinda is the problem. You are, in a way, writing several stylesheets when one may do. If you want to learn, learn the way it's done. Multiple stylesheets is not the way it's done.
Jan 18 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Szar | last post by:
JS noob. I've seen plenty of browser detection scripts but they all seem to be slightly different and don't really fit my needs. I have various places where if the browser is IE I'd like to display...
by: lawrence | last post by:
How is it possible that the question "How do I detect which browser the user has" is missing from this FAQ: http://www.faqts.com/knowledge_base/index.phtml/fid/125 and is only here on this...
by: R. Smits | last post by:
I've have got this script, the only thing I want to be changed is the first part. It has to detect IE version 6 instead of just "Microsoft Internet Explorer". Can somebody help me out? I tried...
by: Jimnbigd | last post by:
What is the recommended code to test browser type, for conditional processing in Javascript? I have seen tests for "document.all". I have seen tests for the actual browser name, or substrings in...
by: phal | last post by:
Hi I think there are many different browsers to browse to the Internet, how can I write the javascript to identify different browser and display according to the users. Some browser disable the...
by: trpost | last post by:
I am looking for a script using javascript to pull browser information including, browser type and version, OS info, plugins (flash, acrobat, media player, etc), java version, etc. that will work...
by: CMM | last post by:
So I'm half way through overseeing a large project in ASP.NET 2.0. My superiors have decided that it would be nice if we ensured the site worked on all the major platforms (as they see it: IE,...
by: petermichaux | last post by:
Hi, Does anyone have a a cross-browser setOpacity function that does not use browser sniffing? I looked at the Yahoo! UI function and it detects IE by looking for window.ActiveXObject. I also...
by: Nathan Sokalski | last post by:
I want to make sure I am doing a browser detection that will work once IE7 is released. My current detection statement (written using VB.NET) is: If Me.Request.Browser.Browser.ToUpper() = "IE"...
by: Conrad Lender | last post by:
In a recent thread in this group, I said that in some cases object detection and feature tests weren't sufficient in the development of cross-browser applications, and that there were situations...
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.