Thursday
Feb262009
Bookmarklet to Take You Home
Thursday, February 26, 2009 at 11:21AM
Say you've followed a link and ended up in http://website.com/blahblah/more_blah/here
And you just want to get to http://website.com?
From michaelhoney.com comes a nice little bookmarklet that takes you back to the home page.
Why don't browsers have this functionality built in?
I'm often select-deleting everything after the slash when deep in some page with no big home button.
Reader Comments (11)
An interesting time to be mentioning this.
Safari incarnations 3 and earlier provided this functionality in its title bar.
If you didn't know, Mac windows allow you to command-click on a window's proxy icon (the icon and name in the title bar). This displays a hierarchical menu of the file that the window represents. So, in a Finder window, you would see the path to its current folder, or in most applications that use documents, in its document windows you would see the path to the document file.
So, in Safari 3, it provided a list of the path pieces to the page's URL. Here's an image I stole from somewhere: http://osxhelp.com/wp-content/uploads/2008/02/safari-title-bar-navigation.png
Safari 4, with its new tabs system, has lost this functionality.
Syphon, thanks for that tidbit!
I've known about the proxy icon in the Finder for a while — t's insane how they've left the proxy icon's functionality hidden). But I didn't realize the Safari parallel.
And now perhaps it's gone for good!
You can still get it in Safari 4, by moving your tabs back to where they were in Safari 3, you just run this on the command line:
defaults write com.apple.Safari DebugSafari4TabBarIsOnTop -bool NO
Then restart Safari. Change it to yes to turn it back on
Thanks Russell, that may soothe the nerves of some unhappy people. Nice looking iPhone apps you make btw!
Keith, thanks for the bookmarklet suggestion. I'm using the new Safari tabs for a few weeks to give them a fair try, and I've been missing the proxy icon.
I find myself select-deleting one or two path elements at a time more often then I jump to home. So these are the bookmarklets in my toolbar:
[edit: deleted faulty code]
Sorry, but the links in my last comment don't seem to be working. Here is the code that i used. Copy and paste it as the "address" of a bookmark:
[edit: deleted faulty code]
Hi Keith, nice of you to say so, though I doubt they stack up to some of your UI design that I've seen in the past. I'm still a programmer pretending to be a designer, and not quite there yet.
I recently came across your blog and it's been an interesting ride so far :)
@Keith
Thank you very much for this wonderful tip.
@Vincent
I tried to use your other bookmarklets but they don't seem to work. I already replaced the quotation marks but when I try to use them absolutely nothing happens.
I hope someone can help here.
Thanks in advance
@Patrick
Sorry, that was my fault for not testing what I pasted. I removed too many %20 (encoded whitespaces). It turned a "return x;" into "returnx;". I really should have known better then to assume something worked.
I have tested both of these, and they worked for me without any fiddelyness:
[↑↑]
javascript:void(location.href=(function(){var x=location.href.split('/');var base=x.slice(0,3);var path=x.slice(3);if(!path.pop().length)path.pop();path.pop();x=base.concat(path);return(x.join('/'));})())
[↑]
javascript:void(location.href=(function(){var x=location.href.split('/');var base=x.slice(0,3);var path=x.slice(3);if(!path.pop().length)path.pop();x=base.concat(path);return(x.join('/'));})())
@Keith,
Is it possible to delete or edit my comment with the bad code?
@Vincent
Sure, I deleted those code snippets for you. Sorry, my comment editing seems a bit broken at the moment, perhaps due to recent speed optimization work.
@Vincent
Thank you very very much!