Jump to content

Does reversed <noscript> exist?


Mudsaf

Recommended Posts

The <script> tag.

 

If you want HTML elements to show up only if script is enabled, it is one of the few valid uses for document.write. Or you can use document.createElement and append them to something.

<script>    document.write("<p>Javascript is enabled.</p>");</script>
<div id="script"></div><script>    var p = document.createElement("p");    p.innerHTML = "Javascript is enabled.";    document.getElementById("script").appendChild(p);</script>

A third method:

<div id="script" style="display: none">Javascript is enabled</div><script>    document.getElementById("script").style.display = "block";</script>
Link to comment
Share on other sites

 

The <script> tag.

 

If you want HTML elements to show up only if script is enabled, it is one of the few valid uses for document.write. Or you can use document.createElement and append them to something.

<script>    document.write("<p>Javascript is enabled.</p>");</script>
<div id="script"></div><script>    var p = document.createElement("p");    p.innerHTML = "Javascript is enabled.";    document.getElementById("script").appendChild(p);</script>

A third method:

<div id="script" style="display: none">Javascript is enabled</div><script>    document.getElementById("script").style.display = "block";</script>

 

What you recommend, messy code or clean interface for non-JavaScript users? :)

Link to comment
Share on other sites

Making sure that the website works for as many users as possible is a good idea. I wouldn't call that code messy.

 

Doesn't google reCaptcha work without JavaScript? I'll get message below.

<iframe src="http://www.google.com/recaptcha/api/noscript?k=6Lc7VdASAAAAADcvby26Vavw4lw47jQwCHDU7EKv" height="300" width="500" frameborder="0"></iframe><br/> <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
Link to comment
Share on other sites

Well the code displays this.

<noscript><iframe src="http://www.google.com/recaptcha/api/noscript?k=6Lc7VdASAAAAADcvby26Vavw4lw47jQwCHDU7EKv" height="300" width="500" frameborder="0"></iframe><br/>  <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/></noscript

Displays sometimes on page like that or messes up the charsets of finnish ä letter. (Attachment @ my last post)

Link to comment
Share on other sites

I don't think there are many large modern websites that work correctly with Javascript turned off. I don't even see the option to disable Javascript listed in Firefox options menu anymore.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...