Possible Duplicate:
Check if JavaScript is enabled with PHP
I need a way to detect if javascript is enabled or disabled in the user-agent in the codeigniter framework
Possible Duplicate:
Check if JavaScript is enabled with PHP
I need a way to detect if javascript is enabled or disabled in the user-agent in the codeigniter framework
You cannot detect this directly on the server-side. Please take a look at this article for alternative solutions: http://www.untwistedvortex.com/detect-javascript-enabled-php/
get_broswer function ?get_browser function: get_browser — Tells what the user's browser is capable of. It lets you know if JavaScript is supported on the user's browser, it can't tell you if it's enabled.You don't get this information with the HTTP-headers. But i have a little workaround:
You can store this information in the User-Session. By default you suggest, that JS is disabled. The first delivered Page should execute a Ajax-Call to a script which tells the USER-Session, that Javascript is enabled.
Of course this has some disadvantages:
Some times it is enough to have the information, if JS is enabled or not, in the CSS. You can do it like this:
<head>
<script type="text/javascript">
// Jquery version
$(function() {
$('body').removeClass('noJs');
});
</script>
<style type="text/css">
.noJs #hello {
display: none;
}
</style>
</head>
<body class="noJs">
<div id="hello">Hello</div>
</body>
get_browserfunction not work.