Jump to content

Script Help Please.


paulmo

Recommended Posts

according to this article I can store data in any browser with html5. unfortunately his script to test it doesn't work even though html5 is in Chrome...console gives me uncaught SyntaxError expected token ILLEGAL. any help greatly appreciated:

<script>if (typeof(localStorage) == ‘undefined’ ) {alert(‘Your browser does not support HTML5 localStorage. Try upgrading.’);} else {try {localStorage.setItem(“name”, “Hello World!”); //saves to the database, “key”, “value”} catch (e) {if (e == QUOTA_EXCEEDED_ERR) {alert(‘Quota exceeded!’); //data wasn’t successfully saved due to quota exceed so throw an error};}; document.write(localStorage.getItem(“name”)); //Hello World!localStorage.removeItem(“name”); //deletes the matching item from the database};</script>

Link to comment
Share on other sites

I think the problem may be due to the characters you're using for single and double quotes. Just use ' for single quotes and " for double quotes. Other types of quotation marks aren't valid string delimiters.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...