JavaScript City

Browser Alert on Page Entry

This script shows an alert with the viewer's browser name and browser version when entering your page.

Script Code

Grab a copy of the file below and place it in the same directory as the Web page on which you will use the script (if you wish to place the script file in a different directory you will need to make the necessary adjustments to the src attribute of the script tag that calls it).

sdetect3.js

The code below should be placed between the <head> and </head> tags or between the <body> and </body> tags (probably near the opening <body> tag).

Example

A working sample of the script is shown below. Click on the link to open the example page and test it out.

Example Link

Options

You can change the message text by editing the line below in the sdetect2.js file. Be careful with the variables on the line.

window.alert("You are using "+navigator.appName+" "+navigator.appVersion);

Accessibility

The same information could possibly be placed on the page somewhere via a server-side script or other means.


eXTReMe Tracker