Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: open URL in the current tab

Reply
Thread Tools

Re: open URL in the current tab

 
 
Jabba Laci
Guest
Posts: n/a
 
      12-11-2012
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')
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: open URL in the current tab Chris Angelico Python 0 12-10-2012 11:14 PM
Re: open URL in the current tab Jabba Laci Python 0 12-10-2012 10:51 PM
Re: open URL in the current tab Boris FELD Python 0 12-10-2012 10:43 PM
Re: open URL in the current tab Joel Goldstick Python 0 12-10-2012 10:39 PM
open URL in the current tab Jabba Laci Python 0 12-10-2012 10:27 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57