Fix the browser's appName with this secret trick
Isn't it weird how when you type window.navigator.appName
into the Chrome Dev Tools that it returns with "Netscape"
?
That's pretty weird, right? We can fix that.
But first let's see what Mozilla Developer Network has to say about the appName
property.
appName
is the name of the browser as a string.
So, since I'm the person browsing, this is correct:
window.navigator.appName = "Zac";
You should obviously put your own name in there, but here's a cool way to set it for all the users of your web page.
var browser = prompt( 'Enter your name, pal!' );
window.navigator.appName = browser;
Now when you check window.navigator.appName
it will return with "Netscape"
, which is correct.
Written by Zac Echola
Related protips
1 Response
+1 for the use of prompt
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#