Skip to content

May I suggest implementing a "save" command #20

Open
AlcherBlack opened this Issue Apr 2, 2010 · 6 comments

5 participants

@AlcherBlack

Unixkcd is extremely convenient when browsing the comics one after another, so allowing to save a specific strip to your computer would be really nice. It shouldn't be too difficult to implement. [save + path]

@sgbeal
sgbeal commented Apr 2, 2010

JavaScript alone cannot be used to save anything. Saving is a browser-specific feature. To save the comic, right-click the image and click "Save image" (or whatever it's called in your browser).

@chromakode
Owner

I like the motivation behind this idea. I think we could have a "save" command that writes the current comic to a cookie, and perhaps a "load" command that gets you back to your saved position.

Or perhaps, we could just do this automatically, and when we detect that the user has a saved position, give them a "would you like to resume where you left off? [y/n]" prompt...

@AlcherBlack

Right-clicking kinda defeats my idea. Is there a way to pop up a "save image" dialog using javascript? (The idea with cookies is brilliant though, and definitely should be implemented)

@danopia
danopia commented Apr 3, 2010

You can have the server return the image as an attachment so that the browser prompts to download (chrome will do it without asking). For saving your spot, though, chromakode has the right idea.

@NickNackGus

In response to sgbeal:

Can't java read what web browser is viewing it? This would allow an if...else tree to save using different methods. I use Firefox, so I can just right click an image to save it, but if it makes people happy to save images using uni.xkcd.com, then they should be allowed by whoever writes the code.

@sgbeal
sgbeal commented Jan 7, 2011

@Nick: neither Java-in-a-browser nor JavaScript have access to save anything to the local machine with the exception of cookies. (This code is JavaScript, not Java, and they actually have nothing to do with each other despite the naming similarity.) Yes, the data could be streamed from the server as danopia suggested, using a separate ajax callback. The user might, depending on the browser, be prompted for where to save it or it might just be saved in the currently configured downloads directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.