Lesson 1: Introducing web storage CHAPTER 15 559
Therefore, the same host, port, and protocol (for example, HTTP versus HTTPS) must be pro-
vided before a webpage can access data written by another page.
Given data storage that was created using the URL http://www.example.com/area1
/page1.html, consider whether each of the following URLs can access that data storage.
■■http://www.otherexample.com/area1/page1.html No, different domains
■■http://store.example.com/area1/page1.html No, different hosts
■■http://example.com/area1/page1.html No, different hosts
■■https://www.example.com/area1/page1.html No, different protocol
■■http://www.example.com:8080/area1/page1.html No, different ports
■■http://www.example.com/area1/page2.html Yes
■■http://www.example.com/area2/page1.html Yes
The strict association to the origin is an important consideration when developing sites
that may be hosted on a shared domain. In most cases, it would be better practice to avoid
using web storage entirely if your site will live within a shared domain in the future, because
any sub-site within the domain would be able to access your data.
Using browser support
Many HTML5 features have different levels of implementation and compatibility by the dif-
ferent browser manufacturers, and this is especially true when working with the different
storage options. By far, the most universally supported storage option is web storage. The
following is a summary of browser support.
■■Web storage
■■Supported Internet Explorer (v8.0 and newer versions), Firefox (v15.0+),
Chrome (v22.0+), Safari (v5.1+), Safari Mobile (v3.2+), Blackberry (v7.0+),
Android (v2.1+), Opera (v12.0+)
■■Not supported Opera Mobile
■■Web SQL
■■Supported Chrome (v22.0+), Safari (v5.1+), Safari Mobile (v3.2+),
Blackberry (v7.0+), Android (v2.1+), Opera (v12.0+)
■■Not supported Internet Explorer, Firefox, Opera Mobile
■■IndexedDB
■■Supported Internet Explorer (v10.0 and newer versions), Firefox (v15.0+), Chrome
(v23.0+), Blackberry (v10.0+)
■■Not supported Safari, Safari Mobile, Android, Opera, Opera Mobile
■■FileSystem API
■■Supported Chrome (v22.0+), Blackberry (v10.0+)
■■Not supported Internet Explorer, Firefox, Safari, Safari Mobile, Android, Opera,
Opera Mobile