Wednesday, April 25th, 2007

Newsvine Live: Evergreen is forever

Category: Showcase, Yahoo!

<>p>Newsvine has relaunched itself. The “evergreen” release empowers the user to create a newspaper that fits their taste.

You will now see:

  • That you can drag and drop content around the page
  • You can add news sources
  • You see how live the web stream is

The live piece is a little disorientating (but you can of course just click the X and be done).

The cool Ajax features are done using YUI, and there are age old hacks hidden in a view source, such as:

javascript
< view plain text >
  1. window.onbeforeunload = function () {
  2.    // This fucntion does nothing.  It won't spawn a confirmation dialog
  3.    // But it will ensure that the page is not cached by the browser.
  4. }

Just having an unbeforeunload event handler — regardless of whether or not it actually does anything, regardless of whether or not you spawn a dialog box or not, even if the entire function declaration consists entirely of just { } — just defining an event handler will prevent the page from being cached — ever.

As a matter of fact, even if you allow page caching, the page will be not be cached. Having an onbeforeunload event means the page will be re-built every single time it is accessed. Javascripts will re-run, server-side scripts will be re-run, the page will be built as if the user was hitting it for the very first time, even if the user got to the page just by hitting the back or forward button.

I have always liked the look of Newvine. It is great to see the relaunch.

Newsvine Live

Posted by Dion Almaer at 12:50 am
4 Comments

+++--
3.4 rating from 14 votes

4 Comments »

Comments feed TrackBack URI

This is behavior is not a bug it is by design, because an empty function does not return true thus the following assert is true:

(function () { })() != true

Comment by zproxy — April 25, 2007

I might add the onbeforeunload hook doesn’t work in Safari either.

Comment by mark — April 25, 2007

The sentence about onbeforeunload is definitely not true. In our case, it’s the other way around.

We have an application where we want our pages not to be cached, and we happen to have an onbeforeunload for every page. It turns out that because of that onbeforeunload handler, our pages is always cached. We have to find some other ways to re-render the pages.

Comment by motor98 — July 17, 2007

So, it is done by YUI?

Any tips out there oh how it was created?

Comment by Morad — September 24, 2007

Leave a comment

You must be logged in to post a comment.