Please despite all the people telling you cant check for a client-side scripting technology. If the target technology has http functions, you can do ALWAYS, just write out a verify step. That means literally, the way to check javascript is to run javascript. If javascript is disabled on the browser side it's not possible to check if the client is Javascript capable (like Dillo with it's default config or others)
UPDATED: I've develop this script because i test some of the examples here and seems that everybody does copypasting without any sort of tests. Code is also on the Gist https://gist.github.com/erm3nda/4af114b520c7208f8f3f (updated)
//function to check for session after|before PHP version 5.4.0 function start_session() { if(version_compare(phpversion(), "5.4.0") != -1){ if (session_status() == PHP_SESSION_NONE) { session_start(); } } else { if(session_id() == '') { session_start(); } } } // starting the function start_session(); // create a script to run on the AJAX GET request from :P Javascript enabled browser echo '<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $.get(document.URL.substring(0, document.URL.length-1) + "?sessionstart=1"); console.log(document.URL.substring(0, document.URL.length-1) + "?sessionstart=1")} </script>; // Ajax GET request handle if ($_REQUEST['sessionstart'] == 1){ $_SESSION['js'] = 1; // save into session variable } else { session_destroy(); // force reset the test. otherwise session } // If the session variable has not saved by the AJAX call, loads again. if (!isset($_SESSION['js'])){ header("Refresh: 1"); // thats only for the first load echo "Javascript is not enabled <br>"; // Return false } else { echo "Javascript is enabled <br>"; // Return true } This solution do not need more files, just a iteration if you run a Javascript capable browser. The value is passed back to PHP using a GET with a simple variable but anyone can fake the output doing cURL to url + ?sessionstart=1. I don't protect that and dont know how unless you add more logic to do right nowit.