Wallpapers Forums Login

How To Detect If User Javascript Is Enabled PHP HTML Script Code Sample

As a web designer you must must know how to make browsing easier for your clients or visitors. Some visitors disable their javascripting in their browser, so when you design a site, you must take this into consideration.

Fortunately, there is a way for webmaster, admin and designers to check if the user's browser has their javascript enabled.

In this little step-by-step tutorial guide, i will show you how to find if the user has their javascritp scripting enabled. In my examle I have a form and in order for the form to work correctly, the user has to have theri javascript enabled, otherwise, the form will not work correclty, so here it is..

1. the first step is to open your favorite text editor. I recommend you use notepad if you are using windows:

2. Once you have notepad opened, copy and paste the following code into the notepad:
CODE:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>How To Detect If User Javascript Is Enabled by Wallpaperama.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {
   color: #FF0000;
   font-weight: bold;
}
-->
</style>
</head>
<body>
<p>The Purpose of this script is to show if you have javascript enabled in your browser.</p>
<p class="style1">
  <script type="text/javascript">
document.write('Javascript is enabled');
  </script>
  <noscript>
  Javascript is disabled
  </noscript>
</p>
<a href="http://www.wallpaperama.com/forums/how-to-detect-if-user-javascript-is-enabled-php-html-script-code-sample-t493.html">&lt;&lt; Go Back</a><p align="center">Script By <a href="http://www.wallpaperama.com">Wallpaperama.com</a></p>
</body>
</html>


3. Now save this notepad document as: "wallpaperama-javascript.html" Make sure you put the quotes when saving the file, some versions of windows will save it as wallpaperama-javascript.htm.txt if you don't put the quotes in between the file name.

4. Now that you have the file saved, you can open it with your favorite browser:


5. DONE - Depending on your browser, if you have javascript enabled or not, it will display a message telling you whether or not you have javascript enabled in your browser.

if you want to know how to enabled or disabled javascript in your browser, visit these posts.

[url=http://www.wallpaperama.com/forums/show-me-how-to-enable-javascript-in-firefox-browser-t43.html]CLICK HERE for Firefox[/url]

[url=http://www.wallpaperama.com/disp-post64.html]CLICK HERE for Internet Explorer[/url]
nILL Sun May 13, 2012
Its really good......... thanx man
Abeera Sun Mar 25, 2012
its really fine, thanks ysapak for helping us
Abhijit Fri Feb 05, 2010
thnks..........it's great. Now i can use this for websites to inform those dumb out there who have javascript disabled.
marc Thu Jan 28, 2010
Cristi, that'd be because your piece of code doesn't work on IE, at least not on IE7. It will redirect you to the non javascript page no matter whether you have it enabled or not.
mark Thu Jan 07, 2010
thanks, but not enough,
have you tested it with navigator ?
and with chrome ?
and more..

i had this option but unsufficient.
somebody, catch up.
serge Wed Nov 25, 2009
cristi u r brilliant thanks
Cristi Sun Aug 30, 2009
why the helll do you make post if you cand do this like this:

<noscript>
<meta http-equiv="refresh" content="0; url= yor_site.tdl/nojavascript.html" />
</noscript>

you don't need to post or do any other javascript testing. it's very simple!
rama Sun Mar 08, 2009
thank u so much. its working awsome. thank u.
keny Mon Jan 05, 2009
if i write in notepad some java script how i will see my work
Jules Thu Dec 11, 2008
perfect!!!!!!!!!!!!1 thank you for making this annoyance simple
gregg Thu Dec 13, 2007
great, with javascript its possible to build sites that fit into any screen, and now at least i can build an alternative for those oldschoolers out there...
wallpaperama Tue Dec 04, 2007

DEMO


Related Content

Information

Share

wallpaperama | Wallpapers | Forums | Terms Of Service

copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Mon May 06, 2013 (-8 GMT)
Powered by: Webune Forums V5