Forum Moderators: not2easy

Message Too Old, No Replies

CSS detection using javascript

Is there a way to check for which CSS is supported?

         

AWildman

1:29 pm on Jul 23, 2003 (gmt 0)

10+ Year Member



Hope this isn't dumb or redundant. My search for css detect on the site search didn't get me what I need. Is there a way, using javascript, to detect a particular browser's css support? i.e. - Can I write some javascript that will detect whether, say, Netscape 6.2.3 supports CSS-1 and CSS-P or is it just assumed that all browsers I.E. v 5 + and N.N. v 6+ support css and therefore if I've already detected the browser, I automatically know that it supports css?

Nick_W

1:46 pm on Jul 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No way unfortunately ;(

There are 2 ways to go in my opinion:

  1. Learn the technology thoroughly.
  2. Use only basic styles like font/text styling
Unfortunately CSS is just not somthing that can be done without a fairly in-depth knowledge....

Nick

AWildman

2:12 pm on Jul 23, 2003 (gmt 0)

10+ Year Member



Well using CSS for me is no problem. I only ask cause I have to do a tech support page for a product. I need to be able to tell the user whether or not their browser is css capable and thus meets our minimum system requirements. I know very well what a pita cross-browser/platform css can be! :)

The code I was given was pretty slick using inline styles to check for CSS-1 or CSS-P by hiding and changing text color. Unfortunately, I can't use that in my overall system check.

Thanks for the response.

ShawnR

2:43 pm on Jul 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Interesting question. (Hehehe, Nick's response deserves a whole other thread...)

I'd suggest you try play with the css property.

e.g. say you have a div which you have sized using css. Check its size is what you set it by something like:

if (this.css.width)
supports_css = parseInt(this.css.width) == what_my_css_set_it_to;

Sorry, taht is not a cmplete answer. I am sure there is a way. Hopefully experimenting with that will lead somewhere.

Shawn

AWildman

2:55 pm on Jul 23, 2003 (gmt 0)

10+ Year Member



How about this: am I correct to assume that NN version 4 and below and IE version 4x and below are the only ones that DO NOT support css? If I can at least verify that, I already know the browser vendor and version so I can make a generalization based on that. I realize that each version since those listed above has bugs, etc., but if in general they all are SUPPOSED to support css, I'd be happy.
I only have to support I.E. and N.N. so I don't need to know if say Opera v X doesn't support css.
God forbid that ALL browsers should follow a set of standards. That would make our lives less interesting. :)

DrDoc

3:02 pm on Jul 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Assume that most browsers do "support" CSS (even NN4, IE4, IE3, etc).

The problem comes when most browsers (particularly all IE, and pre ver6 of the other) do not support it correctly. The only ones you can fully rely on are Opera 6+, Netscape 6.2+, Mozilla 1+ ... and a few others

ShawnR

3:13 pm on Jul 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm with DrDoc. For example, NN 4 provides almost full support for CSS1, although the support is very buggy.

AWildman

3:19 pm on Jul 23, 2003 (gmt 0)

10+ Year Member



Well, it isn't what I wanted to hear :), but I thank all of you for all your help.