Monday, June 17, 2019

JavaScript - Is it Enabled?

JavaScript - Is it Enabled?

This lesson will first teach you how to enable JavaScript in Internet Explorer, Firefox, and Opera, then show you how you can write a very simple script to separate website visitors who don't have JavaScript enabled from those who do.


Enable JavaScript - Internet Explorer

In Internet Explorer 6/7 (download Internet Explorer), you can check to see if JavaScript is enabled by navigating to the custom security settings that are somewhat buried (don't worry; we'll help you find it).

  1.     Click on the Tools menu
  2.     Choose Internet Options... from the menu
  3.     Click the Security tab on the Internet Options pop up
  4.     Click the Custom Level... button to access your security settings
  5.     Scroll almost all the way down to the Scripting section
  6.     Select the Enable button for Active scripting
  7.     Click OK to finish the process
  8.     Click Yes when asked to confirm

Enable JavaScript - Firefox
In Firefox 2 (download Firefox) you can check to see if JavaScript is enabled by navigating to the Content settings under Options.

  1.     Click on the Tools menu
  2.     Choose Options... from the menu
  3.     Click the Content tab in the Options pop up
  4.     Make sure that Enable JavaScript is checked
  5.     Click OK to finish the process

Enable JavaScript - Opera
In Opera (download Opera) you can check to see if JavaScript is enabled by navigating to the Content settings under Preferences.

  1.     Click on the Tools menu
  2.     Choose Preferences... from the menu
  3.     Click the Advanced tab in the Preferences pop up
  4.     Select Content from the list of items on the left
  5.     Make sure that Enable JavaScript is checked
  6.     Click OK to finish the process

JavaScript Detection

These days, it's basically impossible to navigate the web without a JavaScript-enabled browser, so checking whether or not a user has JavaScript enabled is not all that important. Chances are, the only way it be disabled is if the company's IT staff has decided to disable JavaScript for some reason. However, if you still want to be sure your users are JavaScript enabled, this script will get it done.

The only sure fire way to separate users who don't have JavaScript from those who do is to use a simple redirect script that will only work for those with JavaScript enabled. If a person's browser does not have JavaScript enabled, the script will not run, and they will remain on the same page.
JavaScript Code:

<script type="text/JavaScript">
window.location = "http://www.example.com/JavaScript-enabled.html"
</script>

No comments:

Post a Comment