The following script implements a basic protocol_handler (HTTP and HTTPS are not passed to the handler for obvious reasons).
(function() { var run = Uzbl.run; delete self.Uzbl; var escape = self.escape; var String_methods = { replace: String.prototype.replace, slice: String.prototype.slice, match: String.prototype.match }; var protocol_handler = function(event) { var element = event.target; if (event.button === 0 && element.nodeName === "A") { var protocol = element.protocol; if (!String_methods.match.call(protocol, /^https?:$/)) { var handler = run("print @protocol_handler"); if (String_methods.match.call(handler, /^sh\s|^spawn\s/)) { var href = String_methods.replace.call(element.href, /'/g, escape("'")); event.stopPropagation(); event.preventDefault(); run(handler + " '" + href + "'"); } } } }; window.addEventListener("click", protocol_handler, false); })(); // vim: set noet ff=unix
#!/bin/bash PROTOCOL=${8%:*} ADDRESS=${8} case ${PROTOCOL} in mailto) ${XTERM} -e mutt "${ADDRESS}" ;; ftp|ftps) ${XTERM} -e lftp "${ADDRESS}" ;; esac # vim: set noet ff=unix
Save the above scripts to a directory of your choice and add the script to your load_commit_handler and set the protocol_handler eg.
@on_event LOAD_COMMIT script @scripts_dir/protocol_handler.js set protocol_handler = spawn @scripts_dir/protocols.sh