14 January, 2013

Check for Javascript enabled

Rather an easy solution, but still elegant. When you want to make sure the client is running with Javascript (and thus JQuery) enabled; you can basically do this using the simple <noscript> tag. Note that the #outerFrame is the entire site (main Div). By using this approach you get an entirely blank site with only the text: “You need to have javascript enabled to use this site. “. The second the user enables Javascript – the site renders normally.

</head>
<
body>

<
form id="form1" runat="server">
<
noscript>
<
style type="text/css">
#outerFrame {
display: none;
}
</style>
<
div class="noscriptmsg">
You need to have javascript enabled to use this site.
</div>
</
noscript>
<
asp:ScriptManager ID="scrtMgr" runat="server" EnableCdn="true" EnablePartialRendering="true"></asp:ScriptManager>
<
div id="outerFrame" class="main">
……. (rest is omitted for brewity)

No comments:

iPhone/XCode - not all cases are equal!

This bit me! Having made some changes to an iPhone application (Obj-C); everything worked fine in the simulator. But, when deploying the s...