#xkcd on foonetic.
for Firefox and other Gecko-based browsers.
(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.)
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
[Default Applications] x-scheme-handler/xkcd=uri-xkcd.desktop
Test it: random, random (search), 642, 221, something