Reputation: 975
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?
Upvotes: 3
Views: 4150
Reputation: 9304
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.
Upvotes: 0
Reputation: 5263
Maybe How to know and handle disabled JavaScript in the browser can help you.
Upvotes: 0
Reputation: 712
<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.
Upvotes: 7