Click to See Complete Forum and Search --> : Find browser info


FriendInNeed
07-06-2007, 08:21 PM
I want to get information about the user's browser, specificly wether or not it is netscape. and help would be most appreciated.

Kevey
07-06-2007, 08:24 PM
Your server "should" log browser info about your visitors, as well as OS, location, path through the site etc. Do you have access to your server logs? If so, you can get a free log analyzer to read the data. Here's one: http://www.weblogexpert.com/lite.htm

OR, are you wanting to determine the browser as the user visits so you can perform some type of action if they have a specific browser?

felgall
07-06-2007, 11:57 PM
There is no real way to tell whick browser is which because the fields that contain that information are free format user enterable fields. Most browsers will report themselves as Internet Explorer even when they are not.

It is possible to identify Internet Explorer using conditional comments either in HTML or JScript. There is no way to accurately distinguish between non-IE browsers but then all such browsers usually follow most of the standards making distinguishing between them for purposes other than statistics unnecessary. For statistical purposes it doesn't matter that a small percentage is misidentified.

FriendInNeed
07-07-2007, 06:13 AM
Thanks, but the problem isn't statistics. I have a frame with a css menu structure that works on all the major browsers except netscape. The problem is that in the structure, in order for the user to be able to click anywhere in the box and not just on the words, you need to have links inside of links. In every other browser, they automaticly asume that if the mouse clicks on a sub category, it should go to the sub category link. In Netscape, no matter where you click, i goes to the main category link.
So now this raises the question, should I just put the links around the words, or risk loosing netscape customers?
I guess Netscape is only a small fraction of users, but is having the link around the whole box really that big a deal?

• MaNiC MoE •
07-07-2007, 03:02 PM
Well, I think JavaScript could help ;)

felgall
07-07-2007, 05:35 PM
Links inside of links in NOT VALID for any browser. Fix your web page so that you get rid of that HTML error. Chances arer that there are several hundred other browsers apart from Netscape that dislike your garbage code. It is not supposed to work in any browser when you code garbage like that.

mactheweb
07-08-2007, 01:45 AM
There is no real way to tell whick browser is which because the fields that contain that information are free format user enterable fields. Most browsers will report themselves as Internet Explorer even when they are not.

Where did this amazing statistic come from? Most browsers can report themselves as IE if the end user knows how to set the user agent. I doubt that most do. The number of people who even know how to do this is probably such a small percentage of web users to be statistically insignificant. And of the people who do know how, many if not most are probably fairly anti-IE anyway as they are too aware of Internet Explorer's security problems, rendering bugs and lack of features compared to Firefox and Opera.

It is very simple to read the browser version coming to your page. Browser version information is sent out with every browser page request. You can gather that information with JavaScript or any server side scripting language. Your web server logs all page requests automatically.

Most hosting companies offer browser visit statistics programs that turn raw server logs into easy to read and understand charts and graphs that make it easy to track your visitor's browser usage statistics. AWStats is a popular one on 'nix servers.

felgall
07-08-2007, 02:04 AM
A lot of the badly written scripts in web pages are set to only work if the browser reports itself as IE. Most non-IE browsers therefore provide a simple way to change how the browser identifies itself so as to fool those badly written scripts into thinking that the browser is IE and so allowing the script to run. A lot of web pages assume that their visitors are using IE and the only way to get them to work on a proper web browser is to have the browser identify itself as IE. The only browser that makes it difficult to change the useragent is IE itself.

Properly written JavaScript doesn't need to know what browser it is as it uses feature sensing to allow the script to run provided that the browser supports the required statements regardless of what browser it is.

The only reason for checking which browser your visitor is running is for statistical purposes and the stats programs do a better job of analysing the user agents to work out what the browser really is rather than what it claims to be than you can do in several hundred lines of JavaScript. Also for statistical purposes it doesn't matter if the analysis isn't perfect.

• MaNiC MoE •
07-08-2007, 06:13 AM
Well, that's right, but I found out that script that tells you the browser and the user agent. Such as for Mozilla FireFox, it'd tell you :

"Netscape (Moziilla) ..." - This could be kinda helpful...

Anyway, here are some scripts :


<SCRIPT LANGUAGE="JavaScript">


<!-- Begin
var xy = navigator.appVersion;
xz = xy.substring(0,4);
document.write("<center><table border=1 cellpadding=2><tr><td>");
document.write("<center><b>", navigator.appName,"</b>");
document.write("</td></tr><tr><td>");
document.write("<center><table border=1 cellpadding=2><tr>");
document.write("<td>Code Name: </td><td><center>");
document.write("<b>", navigator.appCodeName,"</td></tr>");
document.write("<tr><td>Version: </td><td><center>");
document.write("<b>",xz,"</td></tr>");
document.write("<tr><td>Platform: </td><td><center>");
document.write("<b>", navigator.platform,"</td></tr>");
document.write("<tr><td>Pages Viewed: </td><td><center>");
document.write("<b>", history.length," </td></tr>");
document.write("<tr><td>Java enabled: </td><td><center><b>");
if (navigator.javaEnabled()) document.write("sure is!</td></tr>");
else document.write("not today</td></tr>")
document.write("<tr><td>Screen Resolution: </td><td><center>");
document.write("<b>",screen.width," x ",screen.height,"</td></tr>");
document.write("</table></tr></td></table></center>");
// End -->
</script>




<!-- START OF SCRIPT -->


<!-- HOW TO INSTALL BROWSER PROPERTIES:

1. Copy code into the HEAD section of document
2. Add the onLoad event handler into the BODY tag
3. Put last coding into the BODY section of document -->

<!-- STEP ONE: Add code into HEAD section of document -->

<SCRIPT LANGUAGE="JavaScript">


<!-- begin
function display() {
window.onerror=null;

colors = window.screen.colorDepth;
document.form.color.value = Math.pow (2, colors);
if (window.screen.fontSmoothingEnabled == true)
document.form.fonts.value = "Yes";
else document.form.fonts.value = "No";

document.form.navigator.value = navigator.appName;
document.form.version.value = navigator.appVersion;
document.form.colordepth.value = window.screen.colorDepth;
document.form.width.value = window.screen.width;
document.form.height.value = window.screen.height;
document.form.maxwidth.value = window.screen.availWidth;
document.form.maxheight.value = window.screen.availHeight;
document.form.codename.value = navigator.appCodeName;
document.form.platform.value = navigator.platform;
if (navigator.javaEnabled() < 1) document.form.java.value="No";
if (navigator.javaEnabled() == 1) document.form.java.value="Yes";

if(navigator.javaEnabled() && (navigator.appName != "Microsoft Internet Explorer")) {
vartool=java.awt.Toolkit.getDefaultToolkit();
addr=java.net.InetAddress.getLocalHost();
host=addr.getHostName();
ip=addr.getHostAddress();
alert("Your host name is '" + host + "'\nYour IP address is " + ip);
}
}
// end -->
</script>

<!-- STEP TWO: Insert the onLoad event handler into your BODY tag -->

<BODY OnLoad="display()">

<!-- STEP THREE: Copy code into BODY section of document -->

<center>
<form name=form>
<table border=1 width=300>

<tr>
<td>current resolution:</td>
<td align=center><input type=text size=4 maxlength=4 name=width>
x <input type=text size=4 maxlength=4 name=height></td>
</tr>

<tr>
<td>
browser:</td>
<td align=center><input type=text size=20 maxlength=20 name=navigator></td>
</tr>
<tr>
<td>
max resolution:</td>
<td align=center><input type=text size=4 maxlength=4 name=maxwidth>
x <input type=text size=4 maxlength=4 name=maxheight></td>
</tr>

<tr>
<td>
version:</td>
<td align=center><input type=text size=20 maxlength=20 name=version></td>
</tr>

<tr>
<td>
color depth:</td>
<td align=center><input type=text size=2 maxlength=2 name=colordepth> bit</td>
</tr>

<tr>
<td>
code name:</td>
<td align=center><input type=text size=15 maxlength=15 name=codename></td>
</tr>

<tr>
<td>
platform:</td>
<td align=center><input type=text size=15 maxlength=15 name=platform></td>
</tr>

<tr>
<td>
colors:</td>
<td align=center><input type=text size=8 maxlength=8 name=color></td>
</tr>

<tr>
<td>
java enabled:</td>
<td align=center><input type=text size=3 maxlength=3 name=java></td>
</tr>

<tr>
<td>
anti-aliasing fonts:</td>
<td align=center><input type=text size=3 maxlength=3 name=fonts></td>
</tr>

<tr>
<td colspan=2 align=center>
<input type=button name=again value="again?" onclick="display()"></td>
</tr>
</table>
</form>
</center>


<!-- END OF SCRIPT -->


It's usually in the "Browser's code" field!

felgall
07-08-2007, 02:40 PM
You shouldn't need to know which browser it is for anything other than statistics. If your page isn't working properly in one browser it probably isn't working properly in dozens of other browsers and the code needs fixing properly. Properly coded pages don't need to be patched for any browser except occasionally for IE.

• MaNiC MoE •
07-08-2007, 03:03 PM
Btw, you could make a note that your page works on such n' such browser(s)

felgall
07-08-2007, 05:18 PM
Just remember to test it in all 10,000+ different browsers before compiling the list or you might accidentally leave out listing a few hundred different browsers that it actually works on.