0

I am trying to create a python script that opens a single page at a time, however 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.

3
  • 1
    Its not python's fault. Firefox does not allow 3rd-party apps to arbitrarily control its content. It provides command line option to open new tab or window, but thats all. Commented Aug 4, 2010 at 19:06
  • Ok, so is there another browser that will let me do this? Commented Aug 4, 2010 at 19:09
  • Maybe it's better to close the browser everytime you open an url, so the next time it will be opened only in one tab again Commented Aug 4, 2010 at 19:14

1 Answer 1

1

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)

Sign up to request clarification or add additional context in comments.

2 Comments

Which file are you exactly talking about? I was unable to find an about: config . keep me posted, thanks for the help.
Open firefox, and type "about:config" (without the quotes) into the address bar, and hit enter. From there you can search for browser.link.open_newwindow with the "filter" bar.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.