Filesaver API is new 'HTML5' functionality allowing /exactly/ this. There is just one small problem: the relevant part isn't supported yet in firefox. If you want to use this there is a nice wrapper library which makes this easier for you: filesaver.js
Downloadify is a flash tool which is created for exactly this as well, you can find it here. ('Disadvantage': flash)