Date: 2005-03-23 01:24:00
Tags: rant, web
broken paradigm
You know what I hate about Gallery? It breaks the Back button. For example, go here. Then select page 2 (right above the date). Then hit the Back button. You would expect that you would go back to page 1, right? Nope, you're left staring at page 2 wondering why the Back button didn't work.

(Note: For the same reason that this is broken, going here might take you directly to page 2. If that's the case, select page 1 then hit the Back button.)

This is, of course, just one of the many things I hate about Gallery.
[info]eliset
2005-03-23T13:32:21Z
Couldn't that be fixed pretty easily?
[info]ghewgill
2005-03-23T14:35:54Z
You'd think so, yes. But the design decision that produces this behaviour appears to be quite deliberate. At first the link is ".../gallery/sxsw2005". When you go to page 2, it changes to ".../gallery/sxsw2005?page=2". This appears to set your "current" page for the sxsw2005 gallery to page 2. When you go back to ".../gallery/sxsw2005", gallery just shows you the "current" page as last set. Which isn't page 1 anymore, but page 2. Surely they could have come up with a better design that didn't rely on server-side state for remembering which page was your "current" page. That sort of thing is supposed to be handled by the content of the URL.

An easy way to fix this would be to change Gallery to send an HTTP temporary redirect response when accessing the unqualified ".../gallery/sxsw2005" to the url for the current page, ie. ".../gallery/sxsw2005?page=1". That would preserve functionality and not end up breaking the Back button, because the browser wouldn't store the unqualified ".../gallery/sxsw2005" in its history.
[info]cetan
2005-03-23T19:06:18Z
I've found the people that write the software to be pretty responsive on the gallery message board. Perhaps a note about it there would be in order. Worst that could happen is that they adopt the all-to-typical "our software is fine, the user is wrong" attitude. :)
[info]decibel45
2005-03-23T19:37:31Z
They also seem to be without clue. For example, how on earth do you write exploits into a picture gallery?

Greg needs to add some gallery-like features to his photo gallery and release it on freshmeat or the like.
[info]cetan
2005-03-23T20:41:59Z
Not being a programmer, I don't know how exploits can happen in any software. But it happens, even to the best of software packages.
[info]equiraptor
2005-03-24T00:53:26Z
Isn't that controlled by a cookie? If I don't let a site running Gallery set cookies, it doesn't "remember" which page I'm on like that. Maybe they could add (if it isn't already there) an option to disable this setting of cookies server-side?

Sometimes I like that behavior, sometimes I don't. It's not enough to make me disable cookies on all sites running gallery, even thought that would take almost no work since my browser prompts me about cookies anyway... And I suspect disabling cookies on a Gallery site where I login would prevent me from logging in.
[info]ghewgill
2005-03-24T01:18:48Z
Yes, it appears the current page is stored in server-side state where the user is identified by a cookie. I haven't tested this with gallery, but usually PHP will embed the session ID in the URL if it finds that it can't set a cookie. All this might be configurable and up to the admin, I don't know.
[info]cetan
2005-03-23T14:23:17Z
Gallery is wonderful. :)
[info]cetan
2005-03-23T14:32:47Z
For the same reason that this is broken, going here might take you directly to page 2

For the same reason? I was under the impression that this would only happen if the last time you visited the page you were on page 2 and then you clicked on the album link again. I don't think first time visitors ever are shown any page other than page 2 first. This has been my experience at least.

And yes, that "feature" of Gallery can be annoying. I think JWZ ranted about it once. But it's never bothered me enough to try and fix it :)

[info]ghewgill
2005-03-23T14:36:57Z
Yeah, I mentioned the note about the page 2 thing because I suspect that many of the readers here will have already visited the nucleartacos gallery in the recent past, and may have last viewed page 2. :)
[info]cetan
2005-03-23T14:56:11Z
Oh, good point. :)
[info]cowbert
2005-03-23T15:09:27Z
javascript?
[info]_fool
2005-03-23T21:31:54Z
your browser is broken =)

opera does the right thing. perhaps that is why i still tolerate gallery--i only ever use it in opera.
[info]ghewgill
2005-03-24T01:19:45Z
It might also be that Opera is caching the album pages too aggressively, and the server would say "yes I have new content for that page" if only the browser would ask. :)
[info]_fool
2005-03-24T14:52:48Z
oh, quite likely. i do hit reload more often than one might think would be necessary when i'm polling my LJ friends page for example. however, in this particular case it's a win =)
[info]mskala
2005-03-24T02:03:54Z
It works for me. I have cookies disabled. It doesn't seem to embed a cookie in the URL; I'm pretty sure that PHP only will do that if some effort is taken by the page author to make it use the URL when cookies are disabled.
[info]mskala
2005-03-24T02:04:27Z
Clarification: by "it works" I mean "the back button works, and does not display the broken behaviour you describe".
Greg Hewgill <greg@hewgill.com>