SitePoint Sponsor |
|
User Tag List
Results 1 to 13 of 13
Thread: JavaScript Disable Message
-
Aug 30, 2007, 07:11 #1
- Join Date
- Aug 2007
- Posts
- 266
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
JavaScript Disable Message
Hiya,
Is there anyway of notifying to the user they they have JavaScript turned off?
TicTac
-
Aug 30, 2007, 07:31 #2
- Join Date
- Sep 2006
- Posts
- 731
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
-
Aug 30, 2007, 09:30 #3
- Join Date
- Nov 2004
- Location
- Ankh-Morpork
- Posts
- 12,158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
@Logic Ali: You should use a block-level element rather than a SPAN, since the snippet you posted isn't valid with a Strict DTD. In this case, <p>…</p> seems appropriate.
@TicTac: If you have to display a message like this, you should consider starting over. Progressive enhancement is a much better method: build the page so that it works without JavaScript first, then add JavaScript enhancements (unobtrusively).
That way, people with JavaScript disabled or unsupported (which may not be their own decision) will not notice anything wrong, while those with JavaScript enabled get a better experience.Birnam wood is come to Dunsinane
-
Aug 30, 2007, 12:44 #4
- Join Date
- Sep 2005
- Location
- Sydney, NSW, Australia
- Posts
- 16,875
- Mentioned
- 25 Post(s)
- Tagged
- 1 Thread(s)
There is no longer any need for the <noscript> tag. The HTML contains what you want people without JavaScript to see and simply hide anything that is not needed when JavaScript is available using JavaScript.
Stephen J Chapman
javascriptexample.net, Book Reviews, follow me on Twitter
HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
<input name="html5" type="text" required pattern="^$">
-
Aug 30, 2007, 12:51 #5
- Join Date
- Aug 2007
- Posts
- 266
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
How do you display an error message if JavaScript is turned of if you hav'nt go an <noscript> tag?
-
Aug 30, 2007, 13:03 #6
- Join Date
- Sep 2005
- Location
- Tanzania
- Posts
- 4,662
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
You don't need one. Having javascript off shouldn't cause an "error", it should just provide a less colourful, though not less functional, experience. However, if you really insist on it (bad) and your page cannot possibly function without javascript (bad) and you want to inform the user of this (bad), you create your paragraph with the apologetic text in it and then hide it with javascript. That way anyone with javacscript off will see it and for those with javascript it will be hidden. However, I'd like to point out that this is a bad (bad) idea. Like the above posters said, progressive enhancement is the way forward.
-
Aug 30, 2007, 22:26 #7
- Join Date
- Nov 2004
- Location
- Ankh-Morpork
- Posts
- 12,158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code HTML4Strict:<p id="nojs">If you see this, you don't have JavaScript.</p> <script type="text/javascript"> var p = document.getElementById("nojs"); p.parentNode.removeChild(p); </script>
Birnam wood is come to Dunsinane
-
Aug 30, 2007, 22:55 #8
- Join Date
- Aug 2007
- Posts
- 266
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
JavaScript Disable Message
Isn't it easier just to you the <noscript> tag?
I'm for simplicity.
TicTac
-
Aug 30, 2007, 23:28 #9
- Join Date
- Nov 2004
- Location
- Ankh-Morpork
- Posts
- 12,158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yes, <noscript> is easier. I just answered your question.
Both methods are bad, though.Birnam wood is come to Dunsinane
-
Aug 30, 2007, 23:52 #10
- Join Date
- Aug 2007
- Posts
- 266
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
JavaScript Disable Message
Have you got a thing about using JavaScript?
What do you use then?
TicTac
-
Aug 31, 2007, 00:04 #11
- Join Date
- Nov 2004
- Location
- Ankh-Morpork
- Posts
- 12,158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
-
Aug 31, 2007, 00:09 #12
- Join Date
- Aug 2007
- Posts
- 266
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
What would you not use it for?
-
Aug 31, 2007, 01:17 #13
- Join Date
- Nov 2004
- Location
- Ankh-Morpork
- Posts
- 12,158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
It's far easier to describe what I would (and do) use it for.
I use JavaScript to enhance the usability of a page.
It can be to perform client-side form validation, for performance reasons. You mustn't rely on this, but have the main validation server-side, but doing it client-side if supported enhances the usability.
It can be to use an Ajax solution to populate chained select boxes, like choosing country/region/city. It would still work without JavaScript, but it would require a round-trip to the server for each choice. Using JavaScript it can be faster and improve usability.
It can be to provide toggle features, e.g., hiding lengthy code examples to reduce scrolling for users with JavaScript enabled.
The only time I use JavaScript in such a way that the page doesn't work without it, is on our intranet where I know that it's supported and enabled.Birnam wood is come to Dunsinane
Bookmarks