开发者

Can Apache log if users have JS disabled

We would like to know how many of our site visitors have JS disabled in order to help us decide whether or not we should dev开发者_StackOverflowelop a non-JS version of our new site design. Is this possible with Apache 2.2?


Use the <noscript> tag, the block inside this tag won't be used by the browser if js is enabled.

Then use it to load a specific url, then you will be able to track this url in your apache logs. An image will maybe do the trick (automatic GET from the browser), never tested but I think it should'nt be loaded if js is enabled.

<script type="javascript">
   (...) here anything you could want in js, or maybe nothing as well
</script>
<noscript>
    <IMG SRC="http://mysite.com/nojs.png" width="0" height="0" alt="nojstracking">
</noscript>

No this is quite basic, is loaded at every page request from the user, you cannot track that all requests to nojs.png are different web users, and you cannot compare it to the total number of requests of your websites (and you should be very careful with cache settings of this image response headers). Maybe you'll need to load a different image in the <script> section so that you could compare more easily how many people are requesting the 1st one versus the 2nd one.

To get more accurate results you would need something more advanced, catch theses images url with a server side program (PHP, Java?), handle session cookies, and track existing sessions, you will have more control on your log tracking in server side program than just in Apache (is this an already active session, a new user, someone I already know, etc).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜