This has been covered here recently and it's really off-topic, because it is
an HTTP issue not an HTML issue, but I'll answer it anyway.
In order to do this you need to write a CGI script which inspects various
HTTP headers (which are contained in environment variables). It is BAD
PRACTICE to do anything based on the name of the browser that made the
request. Any decision about content of the reply should be based on the
contents of the HTTP_ACCEPT environment variable, which lists the content
types that the requesting browser can handle.
To determine the last page visited, check the HTTP_REFERER (sp?) environment
variable for the URL of said page (not all browsers support this feature).
Relay Technology, Inc.
The opinions stated above are my own and are not necessarily those of Relay