Information Security

What information can be accessed by modern web browsers?

This tutorial will walk you through what information can be accessed as well as how to display that information. Additionally, we'll discover some basics about what information modern web browsers are able to obtain about your computer, it's OS, what browser you use, your location, and more.




Accessing the information

First we need to know what information is accessible. Refer to the list below for a sampling of what data is accessible by web browsers. This is not an exhaustive list:

Property:appName
Name of the web browser displaying the page
Property:appVersion
Version of the web browser displaying the page
Property:geolocation
API for accessing the user’s current location and user permission settings denying or allowing access to that information
Property:onLine
Whether the browser currently has a network connection
Property:platform
Operating system in use on the client computer
Property:userAgent
String stored in the HTTP user-agent request header, which contains information about the browser, the platform name, and compatibility

*source: JavaScript: The Web Warrior Series: By Sasha Vodnik and Don Gosselin




Writing our script

Using the list above, let's begin wriring our script to display the properties listed. We're going to start with appVersion. We're going to use the Navigator Object to gain and display information from our web browser.

We will use getElementsByTagName to display our content. You must format your html with "p" tags in order to accomplish this. This page has six "p" tags, which is why the number 5 follows the command "document.getElementByTagName("p")". Remember, in JavaScript, numbering begins at zero, not one. So, we want to display our data on the sixth "p" tag, which means we'll use the number [5]. The number five represents the sixth "p" tag in our html document.

See the code below:

			
            document.getElementsByTagName("p")[5].innerHTML = 
                        "<strong>Web browser version: </strong>" + navigator.appVersion;
			
	   

Entering the above code will display the following information:


To view the other items in the list, simply replace what we referenced here, "appVersion", with the other items in the list. For example, the code below will display the operating system, or "platform", installed on your computer:

            
        document.getElementsByTagName("p")[8].innerHTML = 
                        "<strong>Operating platform: </strong>" + navigator.platform;
            
       

The results are displayed below:




You can also access a simplified demo of just the JavaScript code wiuth just two "p" tags in the html on jsfiddle.

You can continue in this manner to display all the information referenced. GeoLocation can be used in a variety of ways to display information. For more info, visit the w3c School's HTML Geolocation API information page.




Web security and what information browsers can access isn't something most people might think about when visiting websites. Below you will find links to articles that discuss this in further detail.