How to Automate HTTP Requests Using Greasemonkey

2007-05-31 13:23:34 GMT

There are some sites that I use daily. The sad thing is, many of them don't provide me any mechanisms to log in automatically, so I have to always do it manually. I also had to fill the same form in on these sites and carry on the same operation over and over again. This was very frustrating for me so I decided to come up with a solution. Greasemonkey seemed to have the potential to solve my burning need.

I want to share the core function I've written that can help you in such scenarios. It's a simple, but very useful one.

Requests are typically triggered based on the content of window.location.href or document.referrer.

Greasemonkey has some ugly annoyances, but fortunately most of them can be worked around. The LiveHTTPHeaders add-on can also help you tremendously constructing the fields of the forms.