Knowing how to test quickly whether a browser supports a data storage method you want to use will make developing pages and applications easier. In this recipe, we will create a script that queries a browser's DOM to test for support of different data storage methods.
You will need access to a modern browser such as Firefox 3.6, or the latest versions of a popular browser such as Google Chrome, Opera, Safari, or Internet Explorer.
First, we are going to create a simple html page. Open an HTML editing program or a text editor, and enter the starting code for a basic HTML5 page:
<!doctype html><html lang="en"><head><title>Client-side Storage Test for HTML5</title> <meta charset="utf-8">
The look of the test page now needs to be styled. We will use <style>
tags within the <head>
tags HTML page, but you could also place them in a separate CSS file.
<style> #results { background...