I have a site that relies heavily on JavaScript and uses jQuery throughout.
I'm not going to attempt to make the site work for those who don't have JavaScript enabled.
However, I would like to show a banner at the top of the page which tells them the site is intended for use with JavaScript enabled and perhaps a modern browser, etc.
I was thinking of just putting a PHP include on all pages that contains a <noscript> with the banner inside that. Is this is good approach or is there a better way?
I have a site that relies heavily on JavaScript and uses jQuery throughout.
I'm not going to attempt to make the site work for those who don't have JavaScript enabled.
However, I would like to show a banner at the top of the page which tells them the site is intended for use with JavaScript enabled and perhaps a modern browser, etc.
I was thinking of just putting a PHP include on all pages that contains a <noscript> with the banner inside that. Is this is good approach or is there a better way?
Share Improve this question edited Oct 2, 2011 at 18:29 Peter Mortensen 31.6k22 gold badges110 silver badges133 bronze badges asked May 31, 2011 at 7:44 giogio 9753 gold badges12 silver badges24 bronze badges3 Answers
Reset to default 7<noscript>
is the way to go.
You should also provide links to other, better browsers in the <noscript>
tag if you can detect that's a browser without JavaScript.
If you wish to be more drastic about it, start with the markup <body class="nojs">
and, onload remove that class with JavaScript.
You could then have body.nojs #wrapper { display: none; }, body.nojs #notice { display: block }
in your CSS.
Maybe How to know and handle disabled JavaScript in the browser can help you.
That is definitely one alternative...
Another is to have the banner visible by default without using noscript
and then a $().ready()
which hides the banner for all JavaScript enabled browsers.