One way to do this is to simply slow down all incoming traffic to your machine, by setting the max bandwidth to some v. small value e.g. a few KB per second. If you then host your file on a web server and hit the external URL to obtain it (the web-server can be running on you dev machine, you just need to remember to use the external URL for the file rather than via localhost
or 127.0.0.1
). The nice thing about this is that it's cross-browser by default.
I'm not sure what the code is on Windows or Linux but if you're using Mac OS X you can use the following code to set the download rate to 2kB/second:
sudo ipfw pipe 1 config bw 2KByte/s
sudo ipfw add 100 pipe 1 tcp from any to me 80
Then when you're finished testing do:
sudo ipfw delete 100
to take the restriction off.
Note: I can't really take credit for this code as it's based on the example from Jonathan Stark's book.