Replacing <noscript> with accessible, unobtrusive DOM/JavaScript

Forums » Dev.Opera » Archived Article Discussions

This topic has been closed. No new entries allowed.

Reason: You can now post comments on articles on Dev Opera

Forum rules and guidelines

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

29. February 2008, 09:36:29

Opera Software

fmpalinkas

Posts: 6

Replacing <noscript> with accessible, unobtrusive DOM/JavaScript

In this article, Frank Palinkas presents an accessible, unobtrusive replacement for <noscript>, built using HTML and DOM/JavaScript, which solves the problem of some older browsers not supporting <noscript> properly.

( Read the article )

Frank

7. March 2008, 12:48:14

Stevie-D

Posts: 5

Another problem with using <noscript> is that some corporate networks and firewalls block some/all scripts. But because this is done behind the scenes, the web browsers think they are supporting Javascript (although they don't get to see very much of it), so correctly ignore then <noscript> element. But they don't run the script either, so the user gets nothing at all.

That's one of the reasons why "graceful degradation" is a bit of a misnomer - the only way to make really good, accessible websites with scripts and styles is through progressive enhancement.

14. March 2008, 23:17:31

FataL

Opera freak

Posts: 1443

Great! But so mutch code!..
I usually do like in this example:
http://rusrestaurant.com/tests/js-css/2/
I will add some interactive example soon.
Main browser and mail: 9.27 • Secondary: 10.63 (still has annoying UI regressions: inability to detach tab normally, passes source file w/o extension to external editors)
extendopera.orgReport bugs to public BTS

31. March 2008, 23:55:21

harkman

Posts: 1

Hello.

I was asking myself if there is a difference in performance if I use sth. like
div.parentNode.removeChild(div)
or
div.style.display = 'none';

Can anybody tell if there is a difference?
Any suggestions which way would be the better and why?

25. April 2008, 07:38:42

renzaijh

Posts: 1

Hello there,

when implementing Frank's script, I noticed the 'noscript' contents appearing briefly when the page loads. Is there a workaround to totally hide the 'peekaboo' if scripts are enabled in web browsers?

Rgds,
Dan

25. April 2008, 18:27:16

FataL

Opera freak

Posts: 1443

renzaijh, you can take a look at my solution mentioned in my previous comment here. I think it's simple and bulletproof.
Main browser and mail: 9.27 • Secondary: 10.63 (still has annoying UI regressions: inability to detach tab normally, passes source file w/o extension to external editors)
extendopera.orgReport bugs to public BTS

2. September 2008, 00:30:52

fuge08

Posts: 1

Renzaijh, I found that if you wrap the noscript tags around the noscript div stated as the solution in this article, it does the trick of removing the "peekaboo" and degrades the same.

So it would look like:
<noscript><div id="noscript">your content</div><noscript>

Supporting browsers would render the noscript first hence hiding the content immediately.

Fatal, I really like your solution, it's very minimal and it seems to do the trick just as well if not better without the "peekaboo" affect Renzaijh was having.

27. January 2011, 10:08:39

Nofanboy

Posts: 10

Though this idea maybe a solution, I wonder why Opera 11.01 does not support the NOSCRIPT tag any more. When I switch off Javascript completely (using F12, e.g.) I would expect that the text between NOSCRIPT and /NOSCRIPT would be displayed. This is not the case any more. Earlier versions were OK. I reported it in December 2010 as DSK-323573 but it was not changed, so the question is, is it a bug or a (questionable) feature.

27. January 2011, 17:04:06

Opera Software

chrismills

Posts: 378

I believe we did remove <noscript> completely, yes, because it's a pretty archaic feature that is better served by providing a default experience that is enhanced/changed by JavaScript if it is available, rather than the other way round. I've personally never seen the point in <noscript>, but I'd be more than happy to get your take on it.

best regards,
Chris Mills
Developer Relations Manager
Editor, dev.opera.com and labs.opera.com

28. January 2011, 10:38:12

Frenzie

Posts: 12328

Originally posted by chrismills:

I've personally never seen the point in


Neither have I, but isn't is more about whether (a significant number of) sites use it?
Intelligent alien life does exist, otherwise they would've contacted us. — CalendarExtend Opera

28. January 2011, 11:03:59

Opera Software

chrismills

Posts: 378

Originally posted by Frenzie:

Neither have I, but isn't is more about whether (a significant number of) sites use it?



I hardly know anyone who uses it these days. I've not seen it on a site for quite a long time. Is your experience different? I will do some more research on this to see if there is any published data on it. Our MAMA survey (http://dev.opera.com/articles/view/mama) doesn't seem to even cover <noscript>.
Chris Mills
Developer Relations Manager
Editor, dev.opera.com and labs.opera.com

Forums » Dev.Opera » Archived Article Discussions