xkcd:// URI handler

Inspired by #xkcd on foonetic.

Use: https://nullroute.lt/misc/xkcd/?q=XKCD_URL_GOES_HERE

View source.

Firefox

for Firefox and other Gecko-based browsers.

To remove:

  1. go to Edit → Preferences → Applications (or Tools → Options → Applications)
  2. find the xkcd entry, choose Application Details
  3. choose the xkcd entry and click Remove

(I tried to add a favicon, but it doesn't show up in the "handler selection" window - probably the script needs to be in xkcd.com.)

Linux/XDG

Download a .desktop file for freedesktop-compliant desktop environments.

Install it to ~/.local/share/applications/, then run:

$ xdg-mime default uri-xkcd.desktop x-scheme-handler/xkcd

Or, add the following to mimeapps.list:

[Default Applications]
x-scheme-handler/xkcd=uri-xkcd.desktop

Test it: random, random (search), 642, 221, something