Is there a specific way to redirect requests for a specific URL from a browser to a local site or location?e.g. setting a Firewall or some OS rule to redirect a request for the jQuery lib to a location on my machine?
Here's what I would do:
- Open up your hosts file in a text editor.
- Add entries at the end of the file that map the domain names you need to 127.0.0.1.
- Save the file.
- Create the directory structure for your domains that match the paths of the files you want to reference and copy the files there.
- In the web server on your local machine, create websites that correspond to the domains you added in step 2 pointing to the folders you created in step 4.
For example, let's say you want to use Google's hosted jQuery, whose path is http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js.
- You would add a hosts file entry of
- You would then create this folder structure:
- You would then copy the
jquery.min.jsfile into the
- After that, you would setup
ajax.googleapis.comas a website on your local web server, pointing to the
ajax.googleapis.comfolder you created.
Considering your question and your comments, you seem to want to reduce bandwidth usage by blocking or caching some web pages and components.
There are Firefox extensions that may help you. In particular Adblock is a generic mechanism for blocking some URLs, and Adblock Plus comes with a list of ad sites to block. Another one is FlashBlock, which delays the loading of flash content until you request it.
Then you should use a web caching proxy. Wwwoffle in particular was designed specifically with dial-up users in mind. Its name comes from its offline mode (serving cached pages only). It also has options to fine-tune how long things should be kept in cache. In particular you can tell it to trust the cache for longer than the site says it's valid (which is perfectly fine in most cases, occasionally means you need to reload pages explicitly, and plain doesn't work with a few sites of dubious design).
You will probably also benefit from a DNS caching proxy (DNS doesn't use much bandwidth but introduces latency). Pdnsd keeps a cache on disk, even when offline (it's a bit like wwwoffle for DNS). Dnsmasq is another possibility.