Since the start, Bemba has used a Lightbox to show the ’share/save’ screen. A lightbox is simply a popup screen that stays inside the current window: it is not an actual new window. We found that this lightbox has too many drawbacks, so we are replacing it.
In the new Bemba, the lightbox will make place for a simple popup. Why?
- Popups are supported by every browser (read on how we deal with blockers)
- Lightboxes require the DOM to be loaded before they work
- We have a toolbar and bookmarklets, lightboxes don’t work for these
- In-line ajax validation is more complex in a lightbox than in a popup.
Other factors that made us decide to move away from the popup were the size of the external javascript file and the fact that there are just so many different versions, each with it’s own quirks. Some don’t work with Prototype, some require JQuery. Although we later discovered the Light Window Helper plugin which offers a great standard way to implement lightboxes in Rails, we decided to just skip the entire thing and move to a regular new window.
Instead of three different versions, there will now be just one with one type of validation.
A real challenge is to circumvent the built-in popup blockers which are present in all modern browsers. After some trial and error, Aaron and I discovered how they all work. Popups that immediately follow a click, are allowed. Even in IE7.
To be specific: there needs to be a window.open call inside an onclick handler for a link.
This is no problem for us at all. In fact, this is the default way to offer popups using the built-in url_helper in Rails. When you open popups like this, they are allowed in all browsers. We can even push more window-related calls to the popup without triggering any further warnings. For instance, I can push out a window.close() in an RJS response on the server, and it will work fine. This comes in quite handy, since it means I can deal with both success and error responses server-side.

Subscribe to our RSS feed


0 Responses to “Lightbox vs Popup: the battle”