Top Document: FAQ: Frequently Asked Questions about CGI Programming Previous Document: 3.5 Subject: How can I get the hostname of the remote user? Next Document: 3.7 Can I trace where a user has come from/is going to? See reader questions & answers on this topic! - Help others by sharing your knowledge Why do you want to do this? Well-written HTML will display correctly in any browser, so the correct answer to this question is to design a template for your output in good HTML, and make sure your output is correct. If you insist on a different answer, you can use the HTTP_USER_AGENT environment variable. This requires care, and can lead to unexpected results. For example, checking for "Mozilla" and serving a frameset to it ensures that you *also* serve the frameset to early (Non-Frame) Netscapes, me-too browsers (notably Microsoft[1]) and others who have chosen to lie to you about their browser. Note also that not every User Agent is a browser. Your page may be read by a user agent you've never heard of, and then displayed by 100 different browsers. Or retrieved by different browsers from a cache. Another reason to write good HTML, and not try to devise a clever or koool substitute. [1] At the time of writing, only Netscape 2+ supported frames, and some authors considered them koool. That's changed, but the same general principle still holds. User Contributions:Top Document: FAQ: Frequently Asked Questions about CGI Programming Previous Document: 3.5 Subject: How can I get the hostname of the remote user? Next Document: 3.7 Can I trace where a user has come from/is going to? Single Page [ Usenet FAQs | Web FAQs | Documents | RFC Index ] Send corrections/additions to the FAQ Maintainer: Nick Kew <nick@webthing.com>
Last Update March 27 2014 @ 02:12 PM
|
Comment about this article, ask questions, or add new information about this topic: