You can have your javascript call a php file, this file will set the session $_SESSION['js_on'] = true; for example. Then in your php, check if $_SESSION['js_on'] is true.