Calling JavaScript inside the webbrowser module

Discussion in 'Python' started by Anders Gunnarsson, Oct 30, 2011.

  1. 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.
    Anders Gunnarsson, Oct 30, 2011
    #1
    1. Advertising

  2. On Sun, 30 Oct 2011 13:33:29 -0700 (PDT), Anders Gunnarsson
    <> declaimed the following in
    gmane.comp.python.general:

    > 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
    --
    Wulfraed Dennis Lee Bieber AF6VN
    HTTP://wlfraed.home.netcom.com/
    Dennis Lee Bieber, Oct 31, 2011
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Stockwell
    Replies:
    0
    Views:
    451
    David Stockwell
    Jun 10, 2004
  2. SPE - Stani's Python Editor

    Firefox bug in webbrowser module on Ubuntu?!

    SPE - Stani's Python Editor, Jan 20, 2006, in forum: Python
    Replies:
    5
    Views:
    411
    Jarek Zgoda
    Jan 22, 2006
  3. Blair P. Houghton
    Replies:
    19
    Views:
    506
    Blair P. Houghton
    Feb 2, 2006
  4. robin
    Replies:
    0
    Views:
    385
    robin
    May 18, 2006
  5. robin

    webbrowser module bug on os x?

    robin, May 25, 2006, in forum: Python
    Replies:
    0
    Views:
    225
    robin
    May 25, 2006
Loading...

Share This Page