def open_in_default_browser(url):
browser_map = setting.get_default_browser()
browser_name = browser_map['name']
browser_path = browser_map['path']
if not browser_path or not os.path.exists(browser_path) or browser_name == "default":
webbrowser.open_new_tab(url)
elif browser_map['name'] == "chrome-private":
# chromex = "\"%s\" --incognito %s" % (browser_path, url)
# os.system(chromex)
browser = webbrowser.get('"' + browser_path +'" --incognito %s')
browser.open(url)
# os.system("\"%s\" -ArgumentList @('-incognito', %s)" % (browser_path, url))
else:
try:
webbrowser.register('chromex', None, webbrowser.BackgroundBrowser(browser_path))
webbrowser.get('chromex').open_new_tab(url)
except Exception as e:
webbrowser.open_new_tab(url)
##########################################################################################
#END
##########################################################################################
评论列表
文章目录