mimic firefox's linkification extension and activate highlighted link feature. Tested on safari 4.0.4

  • linkify bookmarklet
    javascript:
    (function() {
        var pattern = /\b(\w+:\/\/|www\.)([^\s<>]+[\w\d])/ig; /* url */
        var epattern = /\b[\w\d\.-]+@[\w\d\.-]+\w/g; /* mailto */
        function linkify(node) {
    	if (node.nodeType == 3) {
    	    if (pattern.test(node.data))
    		node.parentNode.innerHTML = node.parentNode.innerHTML.replace(pattern, function (str, p1, p2) { return (p1 == "www." || p1 == "WWW.") ? "<a href='http://"+p1+p2+"'>"+p1+p2+"</a>" : "<a href="+p1+p2+">"+p1+p2+"</a>";});
    	    else if (epattern.test(node.data))
    		node.parentNode.innerHTML = node.parentNode.innerHTML.replace(epattern, "<a href='mailto:$&'>$&</a>");
    	}
    	else if (node.nodeName != "A" && node.nodeName != "SCRIPT" && node.nodeName != "TEXTAREA") {
    	    for (var i = 0; i < node.childNodes.length; i++)
    		linkify(node.childNodes[i]);
    	}
        }
        /* code call */
        linkify(document.body);
        for (var i = 0; i < window.length; i++)
    	linkify(window.frames[i].document.body);
    })();
          
    Examples:
      http://snpp.com/
      www.craigslist.org
      ftp://ftp.mozilla.org/
      user@domain.net
      
  • activate link bookmarklet
    javascript:
    (function () {
        function code(node) {
    	var link = node.getSelection().anchorNode;
    	if (link) {
    	    /* simulate mouse click */
    	    var evt = document.createEvent("MouseEvents");
    	    evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
    	    return link.dispatchEvent(evt);
    	}
    	/* failed. recurse frames */
    	for (var i = 0; i < node.length; i++)
    	    if (code(node.frames[i]))
    		return;
        }
        /* code call */
        code(window);
    })();
          
    Bind the bookmarklet to a convenient keystroke (other than RET), like Cmd-Opt-G.