Entry
How do I detect if the browser has style sheets enabled or if it even supports CSS's?
Feb 21st, 2001 17:38
Ben Gordon, John Lawler, VoiceBox (moderator pageresource.com help forum)
You can in a round about way detect if the browser supports CSS, I am
not sure if you can detect if the viewer has his or her preferences set
to override style sheets assigned to the page/site. The following
should detect if the browser supports CSS, since all browsers that
support document.all, document.layers or document.getElementById also
support CSS.
<script>
if (document.all || document.layers || document.getElementById){
document.write("<LINK REL="StyleSheet" HREF="" type="text/css">");
<!--Support CSS-->
}else{
document.write("<LINK REL="StyleSheet" HREF="" type="text/css">")
<!--Non CSS Browser-->
}
</script>