7

If you paste the following into the url bar in chrome and try to do right click-> save as... the save as... is grayed out. Any way to stop this from being grayed out?

URL:

data:text/html;charset=utf-8,%3C%21DOCTYPE%20html%3E%0D%0A%3Chtml%20lang%3D%22en%22%3E%0D%0A%3Chead%3E%3Ctitle%3EEmbedded%20Window%3C%2Ftitle%3E%3C%2Fhead%3E%0D%0A%3Cbody%3E%3Ch1%3E42%3C%2Fh1%3E%3C%2Fbody%3E%0A%3C%2Fhtml%3E%0A%0D%0A
Zero Piraeus
  • 56,143
  • 27
  • 150
  • 160
alumb
  • 4,401
  • 8
  • 42
  • 52

2 Answers2

4

Data URLs are, at the moment, explicitly excluded from the list of savable URL schemes (see http://codesearch.google.com/#OAMlx_jo-ck/src/content/common/url_constants.cc&type=cs&l=11 for context). I'm not sure that that's absolutely correct, and if you file a bug at http://new.crbug.com/ I'd be happy to pass it on to the right team for review.

But, short answer: you can't save data:* URLs right now.

Mike West
  • 5,097
  • 25
  • 26
3

Make the data uri into an anchor tag (<a href="data:etc....</a>"). Then, change the mime type of the data uri to application/octet-stream and the browser mime map will open a save as box when you click the anchor tag.

Tom
  • 4,422
  • 3
  • 24
  • 36
  • Is there anyway to set the file name? Content-Disposition:filename=bob.txt or something ? – alumb Mar 19 '12 at 22:58
  • No, data uris are quite new to the browsers and so there is currently no way to choose the file name; each browser has it's default value for the name. – Tom Mar 26 '12 at 03:43