[Tutor] Starting a browser instance and passing a parameter to it.
Don Taylor
nospamformeSVP at gmail.com
Thu Nov 29 04:42:31 CET 2007
I am trying to start a browser from within a Python program and I want
it to show a local file on my system and I want to pass a parameter to
that browser page that will be picked up by some Javascript embedded in
the page.
I have this code:
import webbrowser
webbrowser.open("file:///D:/EclipseWS/XML-RPCTesting/webbrowser.htm?open=8001")
when executed it does bring up the web-page ok, but the parameter
(?open=8001) is lost. If I try the same thing with an http url then it
works as expected. However, I do not want to run a web-server on my
machine.
Is there any way I can get a browser to display a web-page from a
file-based url and pass a parameter to the code running in that page?
FWIW. I am trying to use a web page as the GUI for a Python program.
The Python program is started in the usual way and it initiates its web
page GUI. The Javascript in the web page then communicates with the
Python program using XML-RPC. The parameter I need to pass is the port
number to be used for this communication.
I am currently using WinXP/Firefox but I want this to work on all
platforms and browser combos.
TIA.
Don.
More information about the Tutor
mailing list