You really cant' do this as you'd have to code seperate modules to support hundreds, if not thousands, of different browsers and applications.
You can handle the browser part very easily without writing a single line of code. It's called a Proxy AutoConfiguration script
]. Just about all browsers support being pointed to a single URL to pickup the script from, thereby configuring the browser proxy settings, even giving you the ability to configure and use different proxy servers depending on the target URL you're browsing to.
Other applications don't support this though. They all have to be configured differently and usually configured by hand to use your proxy server.