简体   繁体   中英

Browser detection: server side or client side?

My application includes a browser extension. I want to provide a single "install" button that references the correct extension, based on the browser the user is using.

What are the pros and cons of server-side versus client-side browser detection?

Remember, this is for actual browser detection and not capability detection, which I would handle completely differently. ;)

Normally you want to detect the browser in the client but you could just as well detect it at the server. Just know that the user agent string can be faked so you can't depend on it. The only sure fire way is to have the user choose the browser but you could use browser detection to suggest.

Here is the client side browser detecting I use and if you really want to here is the server side equivalent. Like I said before there isn't too much difference because they both just look at the user agent string but one thing I did think of is if you do it server side, then you can send down only the link for the browser you think they have where as with the client side version they could view the source and see the links for each browser's extension... not a big deal really but one possible difference.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM