Jump to content

Script Help Please.


paulmo
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...