↓ Twitter is updated more often, so read it! ↓

Select/option dropdowns versus the back button: a workaround

When using select elements on a page (also known as drop downs) as a navigation item, it’s possible that the selected option will persist if the user use’s the browser’s back button.

Consider this workflow:

  1. User clicks on dropdown and selects an item.
  2. Javascript executes, doing something like “window.location = document.forms[0].selectElement.value”
  3. Browser goes to next page.
  4. User clicks back button, browser goes to previous page.
  5. User is confused because the dropdown item contains what they just selected, not what was there when the page loaded.

This is an unfortunate bug/feature in Firefox and Chrome. It actually behaves as one would think in IE and Safari.

The reason is because of Gecko and Webkit’s bfcache, a feature which caches forward and backward pages so that they do not have to be reevaluated in order to be rerendered to the screen. IE reevaluates to rerender. I’m not sure why Safari behaves.

The trick is to use window.onpageshow and window.onload to handle the value of the sortby.

You’ll want something like this:

window.onload = “restoreSelect();”;
window.onpageshow = “restoreSelect();”;

or whatever the equivalent is in your favorite Javascript framework.

Don’t store the value in cookies. It’ll create problems if a user is using multiple tabs. The value I needed is always in the URL, so I could use that for this particular instance.

This trick works for me in Firefox, Chrome, Safari, and IE. I have not tried it on Opera.

HOWTO: Install Gears on 64-bit Linux

I recently noticed that WordPress added support for Gears, as have a few other sites, including ZohoOffice and MySpace.

Gears is essentially offline storage for rich Internet application data. GoogleOS has a list of Gears-enabled sites/applications. Read more on Gears at Wikipedia.

Much to my dismay, the only officially-available Firefox extension supports only 32-bit operating systems. I’m a 64-bit Linux user. Specifically, I use Ubuntu 8.10 Intrepid with my ASUS M3A32-MVP motherboard and 8 GB of DDR2 RAM (4GB of Geil and 4 GB of OCZ).

Fortunately, Gears is an open source project and one intrepid developer made a Gears Firefox extension package which supports 64-bit Linux.

I downloaded and installed the package by dragging and dropping it onto the Firefox Addons dialog, then restarting Firefox when prompted. I archived the Gears extension package on my own site in the event the package is suddenly no longer available. Be sure to check for new versions though, since this package may be out of date if you’re reading this post more than a few days after publication (though unlikely).

Huzzah for open source.

HOWTO: Fixing gnome-vfs ssh support in Firefox

In theory, the package firefox-gnome-support handles GNOME’s Virtual File System URLs. However, out-of-the-box, it lacks support for the ssh handler used when connecting to something via ssh.

To fix this, go to about:config and find the key called network.gnomevfs.supported-protocols. Append ;ssh:, thus changing it to smb:,sftp:,ssh:. It will magically work!

Firefox, I’m not happy with you

At this very moment; as I write this post, Firefox is consuming 144,600 KB of RAM. This is after I recently restarted it, then looked at about five Facebook profiles before starting this post.

I’ll admit it: I have a large number of extensions loaded.

  • Adsense Notifier
  • Chatzilla (inactive)
  • Deepest Sender
  • DOM Inspector
  • Download Statusbar
  • DragDropUpload
  • Dugged
  • ErrorZilla
  • Firebug
  • Flashgot
  • Forecastfox
  • FoxyTunes
  • Gmail Notifier
  • Google Send to Phone
  • Google Web Accelerator
  • Greasemonkey
  • IE Tab
  • lernu (inactive)
  • Long Titles
  • markNewestVersion
  • Resizeable text area
  • ScribeFire (inactive)
  • Slashdotter
  • Splash
  • Stylish
  • Talkback
  • traduku
  • Translate (inactive)
  • Update Notifier
  • VideoDownloader
  • WebDeveloper
  • YSlow

That’s a lot of functionality, there. What of them do I actively use, though? Adsense Notifer is always active so I can see my Adsense amount (btw, it hasn’t changed in almost a month :( ). I’ll generally use Chatzilla when I need an IRC client. I use Deepest Sender to update my Livejournal, but it’s only running when I turn it on. I use DOM inspector every now and then. Download Statusbar and dragdropupload are ridiculously useful and probably my most often used extensions beside Update Notifier.

Dugged is useful for Digg-ery because the Digg effect commonly kills servers. ErrorZilla is nice because it allows me to quickly use Coral or Google Cache to access a down site. I use Firebug quite often, Flashgot, too. I probably use Forecastfox subliminally, but I could do away with it since I have the Yahoo! Weather Widget running on my desktop. I never use FoxyTunes anymore because I never fullscreen Firefox—I can see Winamp all the time.

Gmail Notifier is wonderful—it’s the only way to fly. I’ve used Google Send to Phone maybe once, so it could probably go. Google Web Accelerator boasts that it’s saved me 6.8 hours of browsing time and I’ve had it on for about a month, so it’s probably worth it. However, it’s helper application actually eats up another 50-60 MB and leaks pretty badly.

Greasemonkey is pretty useless just by itself, but I’ve really only got Facebook Autologin installed for it. DiggMeLater and Disemvoweler for WordPress are installed, but I’ve never used them.

IE Tab is useful for when a site won’t allow Firefox or something screws up because the site’s webmaster doesn’t know how to write for Any Browser. Lernu was nice, but it’s not been updated to work with anything past 2.0.0.0. Shucks. Long Titles is wonderful for keeping Firefox from stupidly truncating title attribute popups, but the bug has been fixed in Firefox 3.0 so Long Titles will be useless when that comes out.

I don’t think I’ve ever seen markNewestVersion work. Deleted.

Resizeable Textarea is absolutely a must, especially when writing WordPress entries. Hear me, oh lords of WordPress and Firefox, implement this natively! Safari can do it, and I think Opera can, too.

I’ve never used ScribeFire ’cause it’s awkward and doesn’t let me tag entries with UltimateTagWarrior, the WordPress plugin that adds proper tagging support to entries since WordPress thinks that tagging is silly.

Slashdotter is good because it adds Coral links to every link within a story, and a few other things that I don’t actually use. Splash makes the Firefox startup seem shorter. Stylish is great—I’ve skinned a bunch of web sites and the user interface. Stylish really takes advantage of the cascading model of CSS with its user styles. I’ve used Talkback once, but it’s a key part of Firefox in the event of crashes. I’ve never used Traduku or Translate. Deleted.

Update Notifier should be required for anyone who has any extensions installed. Really, the functionality provided by Update Notifier should be in Firefox natively. Wouldn’t it make sense to actually tell the user that updates to extensions are available instead of just marking internally on the AddOns dialog that they are? Silliness.

I rarely VideoDownloader, but it’s wonderful when I really need it. I use Web Developer all the time and YSlow is seeing a lot of usage, too.

So, there’s a brief overview of my extensions.

I use the Saturated theme, and that’s all I’ve ever used.

I’ll see how removing these unused/rarely-used extensions change RAM usage. Hopefully, it’ll be adequate. If I can get it down to 80 MB on average, I’ll be happy.

Really sweet window effect for Firefox users

When I was working on the previous post, I went to Arby’s web site and found a really, really neat window effect. Shortly after the site’s intro ends, the whole browser window shakes!

I extracted the code and simplified/beautified it a little (it was already pretty easy to follow) for your enjoyment. Check out the page I made for it, the shaking window effect.

Ah, Firefox chrome is fun

Did you know that by going to chrome://browser/content/browser.xul, you can essentially open a browser window within a browser window? It’s great fun.

Check it check it!