How do I edit the url in python and open a new page without having a new window or tab opened?
I am trying to create a python script that opens a single page at a time, howeve开发者_如何学JAVAr python + mozilla make it so everytime I do this, it opens up a new tab. I want it to keep just a single window open so that it can loop forever without crashing due to too many windows or tabs. It will be going to about 6-7 websites and the current code imports time and webbrowser.
webbrowser.open('url') time.sleep(100) webbrowser.open('next url')
//but here it will open a new tab, when I just want it to change the page.
Any information would be greatful,
Thank you.
In firefox, if you go to about:config and set browser.link.open_newwindow to "1", that will cause a clicked link that would open in a new window or tab to stay in the current tab. I'm not sure if this applies to calls from 3rd-party apps, but it might be worth a try.
Of course, this will now apply to everything you do in firefox (though ctrl + click will still open links in a new tab)
精彩评论