Strange User Agent With Google Chrome

前端 未结 5 1313
礼貌的吻别
礼貌的吻别 2021-02-01 14:38

I was working with some javascript and found a strange user agent with my Google Chrome.

I have Google Chrome 7.0.517.41 beta installed on my Ubuntu Laptop. Now AFAIK my

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-01 15:20

    Basically, Mozilla stands for "Mozilla compatible" while "KHTML, like Gecko" describes the rendering engine.

    Essentially, Chrome's user agent string is saying "I'm compatible with Mozilla and my rendering engine is like Gecko" as a way of describing itself to developers.

    Most (if not every) browser will identify itself as Mozilla-compatible as a kind of legacy thing, regardless of affiliation with the Mozilla foundation. Yes, even Internet Explorer.

    More info on strings in general at: Mozilla's developer center.

    Also, if you're developing based on user agent strings, don't. You'll only find yourself in a world of hurt: browsers get upgraded to implement features and your user agent sniff might still exclude them, user agent strings can be spoofed, and good old Opera likes to report itself as Internet Explorer in older versions.

    Instead, use feature detection to determine if a feature you're trying to use exists for a given browser and then use it or don't.

提交回复
热议问题