Monday, February 02, 2004

Broken Back, Button That Is

With the collapsing of recent entries on the front end there are a few bugs. Once expanded, a post's permanent link continues to return false in Firebird. Faulty editing of the onclick event, don't have a fix yet. If you open up IE and succeed in following one of those links you'll see that the archives are collapsed as well, leaving you at the bottom of the page with no idea which post you were trying to look at.

Now Jon points out another problem I've introduced. Open up a recent entry and follow an external link. When you use the browser's back button to return to the page you'll find that the entry you were reading has collapsed. It is effectively failing to "save state" by collapsing entries every time the page loads.

There are two options that I'm considering. One is to have the expand links anchor you down to themselves, effectively passing the post to be opened through the URL like this: divineblog.html#0123456789. This would require some JavaScript scrolling to avoid disorientation after the page loads, collapses, and the entry clicked expands, but will likely be necessary to solve the archives bug mentioned above.

The other option that I'm looking at is not to trigger the collapsing on body.onload(), but instead to put the function at the bottom of the page, above the </body>. That way the page would remain in whatever state you left it in the browser's history and not re-collapse when you go back to it. This is in theory of course, time to test it out.

Thought regarding archives problem: don't collapse the archives.

Update: failure. JavaScript in the page executes every time page loads. Duh.

A more clever idea just in from Mr. Plummer. Check the window.history to see if you are coming back to the page, having already been to history.next. My Definitative Guide is blathering on about UniversalBrowserRead, but it was written for 4.0 browsers. We shall see.

Definitive Guide blathers true. Looks like it's about time to get JavaScript: The Definitive Guide 4th Edition. The 3rd edition was for 4.0 browsers, the 4th covers IE and NS 6, and Mozilla. Might have to take a look at it in the store to see if it thinks in terms of DOM scripting.

No comments: