Thursday, January 19, 2012

Re: java script detection at the time of site load

On Jan 18, 10:04 pm, Miles J <mileswjohn...@gmail.com> wrote:
> You can't detect if JS is enabled via PHP.

You can, however, do something ball-achingly simple like this:

<script>
(function() {
var img = document.createElement("img");
img.setAttribute("src", "/I/haz/js.gif");
document.body.appendChild(img);
}());
</script>
<noscript>
<img src="/i/haz/not/js.gif">
<noscript>

Route each of those 2 permutations to a controller which e.g. logs the
result to the session and then returns a 1px gif image; and if you
really need to know - you know.

AD

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate