DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: IDEA: rule-based browser chooser  (Read 4,805 times)

ayryq

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 292
IDEA: rule-based browser chooser
« on: November 03, 2010, 11:09 PM »
I've been kicking around an idea for a rule-based browser chooser. The idea is, it becomes the default browser, and when it receives a link it launches the "real" browser you wish based on a set of rules which you define.

If it launched quick enough it wouldn't even have to stay resident - it could open, fire the link to the right browser, and then close.

Here's some thoughts:

should be able to define arbitrarily many commands and arguments (e.g. chrome, firefox, chrome privacy, chrome full-screen, etc.)
should work on arbitrarily many rules
should be able to prioritize rules
should be able to set itself up as the default browser even in windows 7
corollary: should be able to unset itself too!

rules
should be able to detect (and act on) which (if any) browser is already running
should be able to identify (and act on) what program called it
should be able to identify (and act on) the url or portion thereof

I think rules should be in a text format. For some reason I'm picturing something like a procmail recipe.
They'd probably be easier to use, though, if they were creatable in a outlook-like manner.

some example rules
Code

//three low-priority rules for default cases
//use the already-open browser if there is one
//(if I'm working in Chrome, use it!), preferring firefox, otherwise run firefox.
If firefox is running
	open url in firefox
	priority 100
if chrome is running
	open url in chrome
	priority 105
if no browser is running
	open url in firefox
	priority 110

//override default case for specific urls
if url contains "gmail"
	open url in chrome
	priority 1
if url contains "windowsupdate"
	open url in IE
	priority 1
if calling program equals feedreader
	open url in firefox-new-window-in-background
	priority 10
if calling program equals farr
	open url in opera
	priority 10

There's a similar program "BrowserChooser" that sets itself as default, which asks what you want to do every time you click a link. http://browserchooser.codeplex.com/
All the other solutions I found on DC also seem to be based on letting you pick which browser when you click the link through various mechanisms. I bet a rule set could cover almost all cases without user interaction.
I actually use gnu/linux most of the time, and I bet this could be done with a simple bash or perl script, but I don't actually think I'd use it on linux - I use firefox for everything. I use single-purpose browsers more in Windows.
It would sure be nice if it could even intercept links clicked in a browser, but this would probably require an extension for each browser?

Does anyone else think this would be handy? Certainly not worth coding just because I want google voice to open in chrome.

Eric

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • Coding Snacks
    • Volunteers/Staff
    • Gathering Badge
    • Participated in NANY Challenge Once
    • Linux User
Re: IDEA: rule-based browser chooser
« Reply #1 on: November 04, 2010, 03:28 AM »
i sort of did the 1st part here, you may try that if you want.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: IDEA: rule-based browser chooser
« Reply #2 on: November 04, 2010, 03:47 AM »
This is an idea i've been so tempted to work on.. though my main idea was regex matching on urls to decide which browser to open the url in.

The thing that has stopped me from implementing it is the "BrowserChooser" application, which is open source and seems to be a great foundation for adding such code.  So unless BrowserChooser is really flawed, i think the best way forward would be for someone to add these functions to that program.

Original address: https://www.donationcoder.com/forum/index.php?topic=24455.0