Javascript UP Bookmarklet

Sometime last June I posted about a Javascript Bookmarklet that lets you move up one directory level.  I had a comment from a user about allowing it to dig into sub-domains when it was at the root.  So I have revised it to allow for this as well as fixed some other bugs that were in it. 

I did some basic testing (by no means exhaustive) on IE 6 and FireFox 0.8, and it seem to work pretty good so I figured I would post it here incase anyone else wants it.

javascript:var m=location.href.match(/(.+:\/\/)([^\.]+\.)((?:[^\.\:\/]+\.)*(?:[^\.\:\/]+)(?:\:\d+)?)(?:(\/(?:[^\/]+\/)*)(?:[^\/]+\/?))?/); void(location.href=m[1]+(m[4]==null||m[4]==""?m[3]:m[2]+m[3]+m[4]));
UP

Published Sunday, April 04, 2004 6:05 PM by puzzlehacker

Comments

# re: Javascript UP Bookmarklet

Cool!

Sunday, April 04, 2004 10:15 PM by Darren Neimke

# re: Javascript UP Bookmarklet

Awesome! I was just about to write one for myself when I found this on google. Nice for browsers that lack a google toolbar.

Sunday, February 25, 2007 7:58 AM by Eliot

Leave a Comment

(required) 
(required) 
(optional)
(required)