Requests for webbrowser module

Jamie ja9749 at my.bristol.ac.uk
Wed Sep 14 12:53:23 EDT 2016


Hi,

I am not sure if this is an intended consequence but when using the 
webbrowser module to open a new blank browser tab in chrome it opens it 
in a new browser window instead of using the current window. Providing 
any complete url provides different behaviour, it opening a new tab in 
the current browser window. Below is some code that produces the 
different behaviours.

blank tab code:
import webbrowser

chrome = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s"
url = "chrome://newtab"
webbrowser.get(chrome).open_new_tab(url)
webbrowser.get(chrome).open_new_tab(url)

normal tab code:
import webbrowser

chrome = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s"
url = "http://google.com"
webbrowser.get(chrome).open_new_tab(url)
webbrowser.get(chrome).open_new_tab(url)

I would like to be able to open new blank tabs in the current browser 
window if possible. If you know of a way to do this with the webbrowser 
module I would appreciate your help. Also is there any chance that the 
ability to close browser tabs will be added to the webbrowser module soon?

Kind Regards,
James Ansell



More information about the Python-list mailing list