This is as days pass by, by Stuart Langridge

And this is An "up" button in the browser, written , and concerning JavaScript and the DOM, Web

At @media Ajax today, in the panel discussion session, someone said that they'd really like an "Up" button in the browser. (Apparently Seamonkey had it, or Opera did, or something.) For people who want it, here's a bookmarklet: up It looks for a <link rel="up" href="..."> tag and uses it if there is one; if there isn't, it chops the last part off the URL.

Comments

Sven Neumann

I very much like the "Link Widgets" Firefox extension which does not only add an Up button, but also Previous and Next.

Jonathan Snook

Instead of parsing the current location, would a simple location.href = '../' do the trick?

Wouter Bolsterlee

The Epiphany browser has a "go up" feature as long as I can remember...

sil

Jonathan: cheezit, if I had half a brain I'd be dangerous. Never thought of that. :-)

Simon

@Sven - yes, that was a feature old Mozilla and Netscape had, not sure if it remains in SeaMonkey. I seem to recall it needed some meta tags on the page in order to work, but it might be possible for an extension to take a guess at where next/prev should go by looking in the DOM...

Joe Grossberg

whatever

David

This bookmarklet is more fine-grained, though I don’t think it looks for any link tags.

James

The link toolbar has been in Mozilla/SeaMonkey forever, and Seamonkey 1.1 binds alt-up arrow to "go up a directory".

Jens

The default Gnome web browser got an up button, and you can even press +". Unfortunately most distros ships some other browser with Gnome :/

Jens

Seams like my post was hurt a bit by some prepocessing.

Anyway, you can just press "the Alt button" pluss "the Up button" in Epiphany to achieve what you want.

hads

Konqueror also includes an Up button.

tante

If you use Firefox as your Browser you should check out the Locationbar² extension which "linkifies" all parts of a URL:

It looks like this:

http://www.example.org/parts/of/the/URL/file.html and every of the underlined parts is clickable (plus the optional marking of the main server name is kind neat)

Paul

The Google Toolbar for firefox also has an "up" button. That and search word highlighting are the main reasons I keep that extension around.

Chipzz

@Jonathan: No it wouldn't. is about the structure of a (set of) document(s), not about the file system structure. Let's say you have chapter 1, (http://example.com/1.html) which has a section 1.1 (http://example.com/1.1.html), and http://example.com/1.1.html has an "up" link to http://example.com/1.html . Both files are in the same directory, yet you're still navigating "up".

Jonathan Snook

the other thing I was going to suggest was to skip assigning to a var and just change location in the loop and exit the function. Then it'd only do the '../' if it didn't exit within the loop. You might be able to shave a few bytes (not that it really matters).

Code: twenty different ways to do the same thing and cocky bastards have no hesitation in pointing out what they are. ;)

sil

Blimey, this code has been more reviewed than anything else I've ever written. ;)

Jon

I think I first remember seeing this in Konquoror. I used to use that as my primary browser in the pre-firefox days because it was faster than netscape/mozilla on my desktop at the time. I've missed it ever since, only recently discovering that epiphany has it too (just not on the toolbar by default)

Jon

I have no idea why that was submitted full of non-breaking spaces. I apologise!

This website belongs to Stuart Langridge. Contact details are available. Don't eat yellow snow. Valid HTML5, at least in theory, except for the bits that aren't because I'm that futuristic that I'm ahead of the spec, oh yes. HTML5 help from Bruce Lawson, among others. Fonts from the superb FontSquirrel. End.