Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to put alternative to noscript to work; fine but not in a mobile browser?
    text
    copied!<p>I recently discovered a gracefully simple way to display a message if the agent has javascript disabled, and it works great -- on my laptop..!</p> <p>I tested it out on mobile safari, it's not working. Is there any reason for it not to? I took into account these things when writing my code:</p> <ol> <li>The markup/dom actually loading/registering, so I put a script tag after the ending tag of my div</li> <li>Any type of reason why it shouldn't work right away, so I made use of the setTimeout function and had it wait 100 ms</li> <li>Used jquery just incase the good old dom lookup and style modification stuff didn't perform as well/correctly</li> </ol> <p>My code:</p> <pre><code>&lt;div id="enable-js"&gt; &lt;div id="content-container"&gt; &lt;div id="text_wrapper"&gt; &lt;p&gt;For the best experience, please &lt;a href="http://www.activatejavascript.org/"&gt;enable javascript&lt;/a&gt;. If your browser is not capable of using javascript, please considering getting a &lt;a href="http://alternativebrowseralliance.com/browsers.html"&gt;better browser&lt;/a&gt;. &lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; (function() { setTimeout(function() { $('#enable-js').hide(); //hide area if scripts enabled }, 100); })(); &lt;/script&gt; </code></pre> <p>Thanks in advance, guys.</p> <p>EDIT:</p> <p>I confirmed the problem is not with Webkit; as well as the fact that it makes no difference starting it off with a self-invoking anonymous function or by placing the hiding code in window.onload as opposed to after the div's closing tag.</p> <p>EDIT2:</p> <p>Confirmed that doing document.getElementById and setting display to none isn't working either! What is going on...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload