MAZES
alert("Stored: "+olddate);
}
catch(e) {
alert("Error with use of local storage: "+e);}
}
If you removed the if (typeof(localStorage) test and tried the code in the old IE, youd see the
message shown in Figure 7-15.
Figure 7-15. Browser error, caught in a try/catch
The Table 7-1 shows the complete date application. Remember: you may need to upload this to a server to
test it.
Table 7-1. Complete Code for the Date Application
Code Explanation<html> Opening html tag<head> Opening head tag<title>Local Storage test</title> Complete title<script> Opening scriptfunction store() { Store function headerif (typeof(localStorage) == "undefined") { Check if localStorage recognizedalert("Browser does not recognize HTML local
storage.");Display alert message} Close if clauseelse { Else