I second the third point. My most productive times are when I have my iPad right next to my laptop ready and waiting for me to need the internet. If I need to look something up I'll do so on the iPad and keep it open if I need to refer to it or turn it off again when I'm done.
I find that not switching between windows really helps me stay in the zone. As soon as that code goes out of sight behind a browser, it's so easy for it to go out of mind.