• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 275
  • Last Modified:

Extensive CSS Support detection

Hi experts !
I need a CSS detection in Javascript that could detect the following CSS support :
- fontsize
- fontcolor
- fontfamily
I'd need to display a different message depending on which checkbox is unchecked (which css styles are disabled) in the client's browser (for both IE and NN)???
0
rouxjean
Asked:
rouxjean
  • 6
  • 5
  • 3
  • +2
2 Solutions
 
arantiusCommented:
rouxjean,
I do not believe it is possible to test for that directly.  The best you could do is detect the browser in another way, and assume based on that the CSS support available.
http://www.google.com/search?q=browser+sniffer
0
 
archrajanCommented:
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
archrajanCommented:
0
 
rouxjeanAuthor Commented:
To give a hint :
here is font family + font size
=========================================================================
<span id=arial style="font-family:Arial Narrow;visibility:hidden">wwwwwwwwwwwwwww</span><br>
<span id=verdana style=font-size:Verdana;visibility:hidden>wwwwwwwwwwwwwww</span><br>
<span id=csscheck style=font-size:15px;visibility:hidden>rouxjean</span><br>
<script>
function checkCSS()
{
     document.getElementById("csscheck").style.fontSize=22;
     if(document.getElementById("arial").offsetWidth==document.getElementById("verdana").offsetWidth)
     {
          alert("please enable font style")
          return;
     }
     if(document.getElementById("csscheck").offsetHeight<22)
     {
          alert("please enable font size")
          return;
     }
     alert("welcome")
}
</script>
<button onclick=checkCSS()>checkCSS</button>
=========================================================================
My question is how to make this work under NN and how to detect font Color support !!!
0
 
rouxjeanAuthor Commented:
I don't need a browser vs compatibility chart nor any tutorial on CSS :-S
I want to detect CSS element support for IE & NN !
0
 
justinbilligCommented:
if( document.stylesheets )
0
 
devicCommented:
I think to check color is not possible
0
 
rouxjeanAuthor Commented:
devic: that code is from you actually :-)
You never tried to make it work with Netscape, I thought maybe I would catch you in a better mood today :-D
Are you ? please !
0
 
devicCommented:
I don't have netscape right now, only firefox and it works ok.
I mean for offsetHeight
0
 
rouxjeanAuthor Commented:
So offsetWidth doesn't work right ? Do you think it is possible ?
0
 
devicCommented:
no rouxjean, just tested: it works right and in netscape and in firefox.
0
 
rouxjeanAuthor Commented:
devic:must have been testing with NN6 back at the time. It works with NN7. I guess there is no way to prevent the user to use his own style sheets, therefore overriding mine (IE option) ?
0
 
devicCommented:
rouxjean,
I don't have NN 6, only NN7.1, mozilla and firefox. If I remeber good, offsetWidth and any offset.... is IE4 object model and not W3C...
But NN6 I think support too. Anyway, if we speak about NON IE, then is firefox or mozilla, but not buggy NN6. I think so :)
0
 
rouxjeanAuthor Commented:
My fault, should have tested it before :-S
I was thinking that maybe NN7 would have allowed more detection since it wasn't out then...
I'm sorry.
0
 
devicCommented:
np, thank you ;)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 6
  • 5
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now