Welcome Guest, Not a member yet? Register   Sign In
Fallback CSS for when javascript is not loaded, enabled, or available
#1

[eluser]Madmartigan1[/eluser]
The problem: Ugly pages while waiting for javascript to load, or when js is disabled, broken, etc.

Possible Solutions:

1. Define no-javascript styles in your default stylesheet
- this can sometimes lead to conflict when the javascript does kick in, which is why I don't prefer it

2. <noscript> load a "no-js" stylesheet </noscript>
- This method feels a bit tacky, but I think its the only way you can avoid a FOBUC without using method 1.

3. &lt;body class="NO-JS" o*nload="func_remove_body_class()"&gt;
- Set a class to the body, and remove it with a javascript function onload
- This way, you can target elements like this:
- .NO-JS #some-js-widget {display:none}
- With this method, you can define no-js styles in your default stylesheet without fear of conflict

Does anyone have any suggestions or comments about this, keeping in mind best practices, fastest loading time, best performance, etc. etc.?

Are there any other good solutions?


Messages In This Thread
Fallback CSS for when javascript is not loaded, enabled, or available - by El Forum - 01-02-2011, 11:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB