Is this safe to do in all browsers? It's a way to simply redirect users to a different place when js is off.
<noscript>
<meta http-equiv="refresh" content="0;url=http://site.com/nojs">
</noscript
I prefer adding no-js
class to <html>
element. You may combine this trick with ie-x
class.
For example:
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<!-- some meta tags --->
<script>
(function(doc) {
doc.className = doc.className.replace(/(^|\b)no\-js(\b|$)/, 'js');
}(document.documentElement));
</script>
<!-- other script tags should be before </body> -->
You can read about it there: html5boilerplate and here