Jump to content

[SOLVED] Check if a user has JavaScript Enabled


chronister

Recommended Posts

Hi All,

I am completely ignorant of javascript and most of my javascript codes come from the free code sites. One day when I have the time and patience I will actually learn this stuff, until then I need your expertise to figure out how to check if javascript is enabled in a users browser and if it is not, then display a message.

I found the JavaScriptEnabled property and have not had much luck with figuring out exactly how to use it. An hour on Google produced nothing usable for me.

I found this, and it is not working for me... Any help or suggestions??

[code]
<script>
<!--
if (JavaScriptEnabled = 'No') {
    document.write("You Must Have Javascript Enabled to use this site.");
}
//-->
</script>
[/code]


Thanks in advance.

Nate
Link to comment
Share on other sites

Better to have the default page be the one that works when JavaScript is disabled.
That way you can have it redirect to a JavaScript-rich page when JavaScript is enabled.

<script type="text/javascript">
<!--//
self.location.href = "withscript.htm";
//-->
</script>
<noscript>
<p>This page is for JavaScript-disabled clients.</p>
</noscript>
Link to comment
Share on other sites

I feel dumb now... lol

I actually do know about the <noscript> tag, an that should have been my first item I tried...... Thanks folks.

I have a site that has js navigation and no alternative, its a family tree site, so its not used by lots and lots of people.... I will simply place a noscript tag in there in case anyone in my family has it disabled.

Thanks,
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.