Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<noscript> not working in Opera 11?

I am testing my noscript tags which display content when javascript is disabled, this works in Safari, Chrome, Firefox, Camino, IE6, IE7, IE8, IE9, basically everything but Opera (I'm running version 11, not sure if its isolated to that version).

In Opera 11 nothing is displayed... is the noscript tag not supported? and what is the alternative?

Nothing surprising:

<noscript>Please enable JavaScript.</noscript>

Located between the body tags.

<html>
<body>
<script>alert('Hello World');</script>
<noscript>Hello World!</noscript>
</body>
</html>
like image 685
cappuccino Avatar asked Dec 24 '10 07:12

cappuccino


People also ask

When noscript tag is executed?

Usage of NoScript tag: The tag defines alternate content that will be displayed if the user has disabled script or browser does not support script. It can be used inside both <head> and <body> tag.

How do I test a noscript tag?

To test the noscript tags, you can use an HTML validator to ensure you've placed the <noscript> tags in valid / legal places in your HTML. Other than that, just view your pages with JavaScript disabled to see the effect. Thanks - so the iframe stuff should be taken out of the noscript tag, correct?

Does the noscript tag do?

The <noscript> tag defines an alternate content to be displayed to users that have disabled scripts in their browser or have a browser that doesn't support script.

What is the noscript element?

<noscript>: The Noscript element The <noscript> HTML element defines a section of HTML to be inserted if a script type on the page is unsupported or if scripting is currently turned off in the browser.


2 Answers

Are you sure you disabled javascript in Opera:

Menu >> Settings >> Preferences >> Content >> Deselect "Enable Javascript"

If so, then post the contents of your entire file here.

EDIT


Until they fix this bug in version 11 which I reckon will happen shortly you can try this:

<script type="text/javascript">
<!--

    document.write("<style type='text/css'>.noScript { display: none; }</style>");

//-->
</script>

<span class="noScript">Please enable javascript in your browser.</span>

You are basically using javascript to show css which hides the no script message, but if javascript is disabled then there is no way that css can be displayed hence the message will show.

like image 111
George Avatar answered Oct 27 '22 20:10

George


Uh, yeah. We (as in Opera) broke <noscript> in Opera 11. Known bug.

like image 34
gsnedders Avatar answered Oct 27 '22 19:10

gsnedders