Calling JavaScript inside the webbrowser module

A

Anders Gunnarsson

Hi!

Is there anyway to communicate with JavaScript inside a website opened via the webbrowser module?

| import webbrowser
| webbrowser.open('http://python.org')

Here I'd like to do something like webbrowser.call('alert(1)')
and I'd like to be able to call the python app from javascript too.

I've looked at pywebkitgtk, but it's messy running on win32.
 
D

Dennis Lee Bieber

Hi!

Is there anyway to communicate with JavaScript inside a website opened via the webbrowser module?

| import webbrowser
| webbrowser.open('http://python.org')
The documentation for Python 2.5 doesn't indicate any such
standardized method. From what I can tell, the default behavior is to
invoke the system defined browser (which could be anything including a
text-only program for a console system).

There does appear to be a .get() method in which you can ask for a
specific browser type -- but you'd still have to handle the case of the
browser not being available...

After that, it would be dependent upon whatever API the browser
opens up to the outside world. For Firefox, that would be XPCOM:
https://developer.mozilla.org/en/XPCOM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top