open URL in the current tab

Chris Angelico rosuav at
Tue Dec 11 00:14:59 CET 2012

On Tue, Dec 11, 2012 at 9:27 AM, Jabba Laci <jabba.laci at> wrote:
> Hi,
> With the webbrowser module you can open a URL in a new tab. But how
> could I tell Firefox from Python to open a URL in the _current_ tab?

If this is for use on somebody else's system, *please don't*. My
current tab is my business, not your program's. But if this is your
own system (eg you want to use Firefox as your GUI), there are a few
options. The easiest, I think, is to have the previous page handle the
transition - trigger it in some way, and then it simply does:

location.href = "some_new_url"

How you go about triggering this is the next problem :) But that
depends hugely on what you're trying to accomplish.


More information about the Python-list mailing list