Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #34584 > unrolled thread
| Started by | Jabba Laci <jabba.laci@gmail.com> |
|---|---|
| First post | 2012-12-11 01:05 +0100 |
| Last post | 2012-12-11 01:05 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: open URL in the current tab Jabba Laci <jabba.laci@gmail.com> - 2012-12-11 01:05 +0100
| From | Jabba Laci <jabba.laci@gmail.com> |
|---|---|
| Date | 2012-12-11 01:05 +0100 |
| Subject | Re: open URL in the current tab |
| Message-ID | <mailman.696.1355184377.29569.python-list@python.org> |
Hi,
> If this is for use on somebody else's system, *please don't*. My
This is for me. I have a simple GUI that produces some URL that I want
to open in the current tab. Since I want to verify several URLs, I
don't want to open dozens of new tabs.
Here is my working solution. It requires the MozRepl Firefox add-on
that I mentioned in the previous message.
Laszlo
===========================
import telnetlib
HOST = 'localhost'
PORT = 4242 # MozRepl default
def open_curr_tab(url):
tn = telnetlib.Telnet(HOST, PORT)
cmd = "content.location.href = '{url}'".format(url=url)
tn.read_until("repl> ")
tn.write(cmd + "\n")
tn.write("repl.quit()\n")
#########################
if __name__ == "__main__":
open_curr_tab('http://www.python.org')
Back to top | Article view | comp.lang.python
csiph-web