PHP Classes

jsCheck: Check whether Javascript is enabled in the browser

Recommend this page to a friend!
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 60%Total: 1,070 All time: 3,475 This week: 455Up
Version License PHP version Categories
jscheck 1.0GNU General Publi...5.0HTTP, PHP 5


This class can be used to check whether Javascript is enabled in the browser.

It can generate a HTML form with Javascript to automatically submit it when the page is load.

The class can set cookies or session variables to avoid the need to generate the form to check again if the browser has Javascript enabled.

Innovation Award
PHP Programming Innovation award nominee
April 2009
Number 6

Prize: One subscription to the PDF edition of the PHP Architect magazine
Some sites implement features that depend on Javascript libraries or embeddable elements that need Javascript to properly integrate them on the page.

However, sometimes Javascript support is disabled on the browser for some reason.

This class provides a solution to detect whether Javascript is enabled on the browser, so the applications can display alternative content or show messages to tell the user that enabling Javascript support is necessary.

Manuel Lemos
Picture of Gustav Eklundh
Name: Gustav Eklundh <contact>
Classes: 3 packages by
Country: Sweden Sweden
Age: 34
All time rank: 12119 in Sweden Sweden
Week rank: 276 Up2 in Sweden Sweden Up
Innovation award
Innovation award
Nominee: 1x


jsCheck - Readme **************** This class gives you the ability to, with PHP, check if the user has JavaScript activated or not. This can be done by two different ways, where the first one is using a form and let JavaScript submit it before the page has loaded. Then PHP are able to see if there were any POST-data, and if so, the user has JavaScript activated. The other method is by using cookies. This requires the user not only to have JavaScript activated, but also allow the site to set cookies. With that said this method has one more drawback compared to the form-method, and that is that the user have to manually reload the page (probably by navigating somewhere on the site) so that PHP can check if the cookie is set. The checkJsByForm()-function is used for the first method, while checkJsByCookies() is used for the second one. After either of those two is called, you must also call the function isJsActivated() to see if JavaScript really is activated or not. This function returns true if JS is activated and fals if it isn't. And finally; I hope that someone will find this script usable, and if you have any comments or thoughts about it, feel free to contact me through email;

  Files folder image Files  
File Role Description
Accessible without login Plain text file class.jscheck.php Class The class itself.
Accessible without login Plain text file example.php Example Example on how to use the class.
Plain text file readme.txt Doc. Documentation on how to use the class
Plain text file LICENSE Lic. The GPL v3 license

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:3,475
This week:455Up
User Ratings User Comments (1)
 All time
Easy and useful :)
14 years ago (Mikel Sulanjaku)