Forum Moderators: open
However, there is no such thing as an "optimized" script for your needs. Do you need to recognize all browsers? Well, then it's important that many common browsers can identify themselves as any browser.
Browser sniffing is seldom very reliable. If possible, try to avoid it.
Now, the best advice I can give you is to download DevEdge's user agent sniffer. Then you need to modify it to suit your needs. Learn how to use simple JavaScript constructs as:
navigator.userAgent
navigator.appName