var name=navigator.appName;
console.log(name)
I wrote the javascript code and ran it on Google browser, and it said Mozilla.
Is this correct?Is there something wrong?
In Internet Explorer 11, Microsoft Edge, Google Chrome, and Mozilla Firefox, "Netscape"
was displayed.
It is recommended that you do not refer to this value unless you need it specifically.
It is correct that "Mozilla" is displayed on Chrome.And there is a historical reason for this.
The result returned by navigator.appName is probably based on the value in the User-Agent header, but there was a time when the site was sorting out the process based on whether or not it contained the Netscape code name "Mozilla.
(Only some browsers will receive preferential treatment)
To avoid this problem, many browsers now include Mozilla (compatible).
The User-Agent is not very reliable information because it can be easily disguised in many ways.
reference:
User Agent - Wikipedia
© 2024 OneMinuteCode. All rights reserved.