2

Please correct me if I'm wrong, but I believe the Web DB is domain specific and you should be able to access it from any page from within the same domain? For some reason I'm not able to.. so xxxxxx.com/index.html creates a DB and xxxxxx.com/index2.html doesn't see it.. I verified in Chrome 10+ and Safari 5.. any ideas?

2 Answers 2

1

It's origin-specific. That means protocol + hostname [+ non-standard port] (e.g. "http://stackoverflow.com" != "https://stackoverflow.com")

Sign up to request clarification or add additional context in comments.

1 Comment

1

Ok, great news for me - I was able to figure this out on my own.

So Web SQL uses Same Domain Origin Policy as Eli was saying, however the answer to my question was how to access the db from a separate page on the same domain since it wasn't showing up.

You must open the DB on every page you want to access. This is different from local storage, i know.

So on index.html i created a db instance with:

db = openDatabase('mydb', '1.0', 'feeds', 2 * 1024 * 1024);

and I needed to do the same for index2.html, I threw it into an onload function and boom! it works.

super happy.

1 Comment

This is good to know because it's not obvious why the database doesn't automatically show up in the Resources tab in Chrome's Developer Tools.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.