Discussion Locked
0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
What would be the code needed to identify what browser is using your site and should this be in a function that is activated on an onLoad()?
1 reply
by jay eckles
You want to inspect the navigator object, specifically the userAgent and appVersion properties.
Whether you call the function from the onLoad event depends on what you're doing. If the HTML you render is dependent upon the browser version, then onLoad is a bit too late. I'd define the function in the HEAD, then call the function immediately after its declaration. You can then use the result in the BODY as it is being dowloaded and rendered.
By the way, do a Google search on "browser sniffing". The first hit is a really good explanation of sniffing and a really good script.
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending
Discussion Locked
What Makes a Business Website Effective in 2026
2 helpful
10 replies
1 helpful
3 replies
Question
Windows and macOS computers becoming slow or unstable after updates - what should I check first
0 helpful
1 reply
Question Unanswered
Best Way to Make Long WordPress Location Guides Mobile Friendly
0 helpful
0 replies
Discussion
Optimizing WordPress widgets and DOM size
0 helpful
3 replies