JIM Control Usage Manual : Using Cookies And Detecting Web Browser Type
[ To Table Of Contents ]

The JIM Control also contains some commonly used functions that a web site owner is likely to employ. These are reading and writing cookies as well as being able to detect the web browser and operating system a web browser is on (it is commonly known that, in some cases depending on the complexity of client-side scripting, the same web browser on one operating system will work differently than the same web browser on another operating system). Being able to also detect operating system in user-agent data can help determine such differences.

Cookies
One thing to always remember about cookies is that you cannot set a cookie and read a cookie in the same instance...that is, after a page loads you set a cookie, the cookie can't be read unless the page is refreshed or another web page is called that reads the cookie data.

If you need to read the value of a cookie, simply use the function wread_cookie(cookiename) where cookiename is the name of the cookie that you would like to read. The function returns the value of the cookie. If you need to set the value of a cookie, use the function wset_cookie(cookiename, cookievalue, lifetime). Cookiename is the name of the cookie you wish to create or update, cookievalue is the value you wish to store and lifetime is the number of days that you would like to keep the cookie alive for. If you specify a lifetime of 0 (zero), the function will automatically create a session cookie. A session cookie is a cookie that will expire or die when the user closes their web browser.

Detecting Web Browser Type
A global variable in the JIM Control has been allocated to hold a flag value representing the web browser / operating system that was detected, so all you need to do in scripting code that you may create is reference that variable. The name of the variable is net_browser. It will contain an integer value which indicates the web browser / operating system combination detected. Please reference the lookup value table below to determine what the integer value means:

Unix / Linux:
1Konqueror
Macintosh:
2Unknown Web Browser
3Internet Explorer Web Browser
4Safari Web Browser
5Firefox Web Browser
6Netscape Web Browser
7Opera Web Browser
8Camino Web Browser
9Firebird Web Browser
Windows:
10Unknown Web Browser
11Internet Explorer Web Browser
12Firefox Web Browser
13Netscape Web Browser
14Opera Web Browser
15Camino Web Browser
16Firebird Web Browser
Unknown Operating System:
17Unknown Web Browser
18Safari Web Browser
19Internet Explorer Web Browser
20Firefox Web Browser
21Netscape Web Browser
22Opera Web Browser
23Camino Web Browser
24Firebird Web Browser