Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting when styles disabled

What's the best way to detect, with JS, if the user has disabled your stylesheets? Is there a reliable way even?

like image 826
wheresrhys Avatar asked Feb 03 '23 22:02

wheresrhys


2 Answers

How about asking them?

<div style="display:none">This site relies on CSS, please go to our <a href="noncss.html">CSS free version of this site</a></div>
like image 67
mplungjan Avatar answered Feb 05 '23 11:02

mplungjan


Something easy would be to check the body background color for instance.

However, how likely is it someone disables CSS and not Javascript? (dunno what you use it for obviously)

like image 35
plebksig Avatar answered Feb 05 '23 13:02

plebksig