Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm building a Quickly ~ HTML5 Application, it works great until I try to use WebSQL Storage, which fails to open a databse:

var db = openDatabase('mydb', '1.0', 'Test DB', 5 * 1024 * 1024);

giving the next error: Error: SECURITY_ERR: DOM Exception 18

The Python code that calls the webview is this:

    self.webview = WebKit.WebView()
    self.scroller.add(self.webview)
    self.webview.props.settings.enable_default_context_menu = False
    self.webviewsettings = self.webview.get_settings()
    self.webviewsettings.set_property("javascript-can-open-windows-automatically", True)
    self.webviewsettings.set_property("enable-universal-access-from-file-uris", True)
    self.webviewsettings.set_property("enable-developer-extras", True)
    self.webviewsettings.set_property("enable-html5-database", True)
    self.webviewsettings.set_property("enable-html5-local-storage", True)
    self.webviewsettings.set_property("enable-offline-web-application-cache", True)
    self.webviewsettings.set_property('enable-file-access-from-file-uris', 1)
    self.webview.load_uri(get_media_file('app/index.html'))
    inspector = Inspector(self.webview.get_inspector())

    self.webview.show()

What I'm I doing wrong? any help will be apreciated (:

share|improve this question
up vote 2 down vote accepted

This is not related to python, but javascript under webkit. Please see this question on Stack Overflow.

To summarise it, you can't use openDatabase over local web pages, you will need to use a full local server.

You can use SimpleHTTPServer to start a server from python and connect to it using webview.

share|improve this answer
    
Wow that is great! thanks :) – victorhqc Jan 9 '13 at 3:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.