View Single Post
  #2 (permalink)  
Old 01-25-2008, 02:42 PM
wige's Avatar
wige wige is offline
Moderator
WebProWorld Moderator
 

Join Date: Jun 2006
Location: United States
Posts: 1,722
wige RepRank 4wige RepRank 4wige RepRank 4wige RepRank 4
Default Re: How do I require JavaScript (Active Scripting)?

Since page content can only be changed using Javascript, you should have the default page content show the error message indicating that Javascript is required. For example:
HTML Code:
<div id="jscheck">
   <p>This function requires JavaScript. You're browser does not support the Javascript functions
   used to implement this function, or JavaScript is not enabled. Please enable JavaScript on
   your browser and refresh the page.</p>
</div>
And then create a script that will replace the error message if JavaScript is enabled on the visitor's browser.

Code:
<script>
if (document.getElementById) {
   formarea = document.getElementById("jscheck");
   formarea.innerHTML = '<p>You have JavaScript enabled! Yay!</p>';
}
</script>
__________________
The best way to learn anything, is to question everything.
Interestingly Average Security Blog

Last edited by wige : 01-25-2008 at 02:42 PM. Reason: Forgot the closing bracket
Reply With Quote