I am trying to enable flash in my Quickly app.
I have a WebKit/webview in a scrolledwindow.

I know on Android you need to enable javascript an plugins.

I have look in the WebKit2GTK+ Reference Manual

So my code look like this:

#gets the WebView and scrolledwindow wiget object.  
self.scrolledwindow = builder.get_object("scrolledwindow")  
self.webview = WebKit.WebView()   

self.settings = self.webview.get_settings()
self.settings.set_property("enable-plugins", True)
self.settings.set_property("enable-javascript", True)

But it does not work :( Or in fact, I can hear the sound from the video, just not see images.

The terminal response look like this:

    self.settings.set_property("enable-javascript", True)  
TypeError: object of type `WebKitWebSettings' does not have property `enable-javascript'  

It can run with out the self.settings.set_property("enable-javascript", True) line, but so again no image on the video.

NB: I'm on my first week with python, so I am a noob to Python ;)


Here's a rendition of some working code. Note how the settings are instantiated and later the browser is told to set those settings.

    self._browser = webkit.WebView()


    browser_settings.set_property('user-agent', ' '.'abc')

(Looks like the useragent= line is superfluous.)

| improve this answer | |
  • John thank you very much :) your code actually helped me lot, I have added an ipod-user-agent then it run on my laptop.. Voidcode ;) – Voidcode Aug 18 '12 at 21:48

You don't have a variable on the object returned. Terminal has no idea what the "object" is.

| improve this answer | |
  • Yes.. but in the WebKit2GTK+ Reference Manual there is property call 'enable-javascript' and it gets no error with the 'enable-plugins'. – Voidcode Jul 24 '12 at 2:53

After trying John S Gruber´s code.

I try with a ipod-user-agent.

Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10

This works :)

I don´t know how, I´am using an Aspira 5750 Laptop for testing.

It looks like it switch to an default-player, and not the dr.dk´s flash-player. but it works!!

self.webview = WebKit.WebView()

#gets webview.get_settings object.
self.browser_settings = self.webview.get_settings()

self.browser_settings.set_property('user-agent', 'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10')


NB: If I try with user-agent like this Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:14.0) Gecko/20100101 Firefox/14.0.1 Then the video runs slow and do NOT work !!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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