jsCheck: Check whether Javascript is enabled in the browser

Recommend this page to a friend!

  Author Author  
Picture of Gustav Eklundh
Name: Gustav Eklundh <contact>
Classes: 3 packages by
Country: Sweden Sweden
Innovation award
Innovation award
Nominee: 1x


  Detailed description   Download Download .zip .tar.gz   Install with Composer Install with Composer  
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.

Details
{startverticalbanner}
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; gustav@xcoders.info.

  Classes of Gustav Eklundh  >  jsCheck  >  Download Download .zip .tar.gz  >  Support forum Support forum (1)  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  

 

Name: jsCheck
Base name: jscheck
Description: Check whether Javascript is enabled in the browser
Version: 1.0
PHP version: 5.0
License: GNU General Public License (GPL)
 
  Groups   Applications   Related pages   Files Files  

  Groups  
Group folder image HTTP HTTP protocol clients, headers and cookies View top rated classes
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes


  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

  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.


  Related pages  
http://threebyte.eu/2009/03/14/two-methods-of-detecting-javascript-through-php/
My blog-post where I first announced the script.

  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

Install with Composer Install with Composer - Download Download all files: jscheck.tar.gz jscheck.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.

For more information send a message to info at phpclasses dot org.