views:

72

answers:

2

I'm opening a webpage in the default webbrowser on the system using python's webbrowser module.

I want to check if the site is already open in the browser and only open a new tab/window if it is not. Otherwise reload the already opened page.

Is there a way to do this with webbrowser module? If not, is there any other module i can use to do this.

A: 

use

webbrowser.open( url, new=0 ) 

this tries to open the website in the same windows if possible, if you set the new parameter to 1 a new window/tab will be generated

but i'm not sure if this works reliable on all plattforms

Nikolaus Gradwohl
well, this is not what OP asks, is it?
SilentGhost
why not? he wants to reload the page if it already is open, otherwise open a new tab or window - this is exactly what the webbrowser.open method does according to the reference documentation
Nikolaus Gradwohl
This is exactly what I'm looking for, but it doesn't work. I'm on Ubuntu Linux.
Owais Lone
as i said - i'm not sure if this works reliable on all plattforms. It works on my mac using safari. But i didn't get firefox to reload the current tab on ubuntu - even without python.
Nikolaus Gradwohl
A: 

from http://docs.python.org/library/webbrowser.html#webbrowser.open_new_tab

webbrowser.open_new_tab(url)

Open url in a new page (“tab”) of the default browser, if possible, otherwise equivalent to open_new()

remosu
how does it check whether the url is already open?
SilentGhost
upss... I think I misunderstood the question
remosu