History Keeper

February 27th, 2009

Update: Beta 2 is out.

unFocus History Keeper is a JavaScript based library for managing browser history (back button) and providing support for deep linking for Flash and Ajax applications.

Demos, examples, and sightings in the wild, coming soon. In the mean time, you can check out the example page in SVN or check out adcSTUDO for a demo. The test page contains a small silly JavaScript application that takes what you put in a confirmation box, and makes a history entry out of it.

You can check out the latest version from SVN from either the trunk (I try to keep it working there, but no guarantees) or one of the tagged releases (each release gets a tag), or you can download the latest release archive from the downloads page on the google code site.

You will find three compressed JavaScript files in the root of the archive, unFocus-History-p.js and unFocus-HistorySwf-p.js.

unFocus-History-p.js contains:

  • EventManager.js
  • History.js

unFocus-HistorySwf-p.js contains:

  • EventManager.js
  • History.js
  • FlashPlayerInfo.js
  • SwfUtilities.js
  • SwfHTML.js

ObjectPatentMagic-p.js is a compressed version of Object Patent Magic of course.
Features:

  • Enables back button support, for your client-side web apps!
  • Hash based deep linking (Anchor Style – index.html#foo=bar)
  • Event driven – Subscriber pattern
  • Support for all current browsers:
    • recent Operas (mostly)
    • Firefox
    • Safari 1.2+
    • IE 5.5+

Known Limitations:

  • All history entries (back button states) modify the location string.
  • Doesn’t remember last entry if you leave the app and come back in some browsers (that’s a bug, I’ll fix it).
  • Editing the url manually will stop further updates to the url in some browsers.
  • Konqueror support is still a bit flaky (this history is off by one in an odd way).
  • Forward button doesn’t work in Safari 3.0 beta (after you press back).

Related Links – Note: I’m trying to put links to everyone who helped me out over the years. If I left you out, please let me know.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • Technorati
  • Yahoo! Buzz
  • Slashdot
  • TwitThis
  1. herfmarc
    March 12th, 2009 at 13:51 | #1

    — swf communicating with html on runtime —

    … first-of-all: thanks for all of your work !!!

    i wonder if/how one may send/receive data to/from the embedded swf on runtime
    without reloading the swf – may you please let me know ?

  2. March 13th, 2009 at 12:18 | #2

    There are a number of ways to do that. I used to have something in the unFocus tool set that would allow for that, but have discontinued it, since there is a built in (and more reliable) way to do that since Flash Player 8.

    It’s called External Interface, and is fairly easy to use, once you wrap your head around it.

    To send info into the swf from javascript, you’ll need to use ExternalInterface.addCallback to add a javascript function handle, then call that from Javascript by getting a reference to the embedded swf’s DOM object, and calling that method. Here is an example: unFocus.SwfUtilities.getSwfReference(”swfID”).yourCallbackFunction();

    You’ll need to make sure you set Allowscriptaccess to a value that allows that communication with the script.

    (Akizmet marked this as SPAM, LOL)

  3. Egor
    June 23rd, 2009 at 23:09 | #3

    I’m change your method “_getHash” in “unFocus-History-p.js”. See changes. My variant is more correctly:

    var _getHash = function() {

    if (/MSIE/.test(navigator.userAgent) || window.opera) {

    var result = /\?([^\?\#]*)$/.exec( location.href );
    var search = (result && result[0]) ? result[0] : ”;

    return location.hash.substring(1) + search;
    }

    return location.hash.substring(1);
    };

  4. June 28th, 2009 at 22:59 | #4

    Hi! What bug or issue does that address? I’ll take acloser look at that soon. Thanks! :-)

  5. Egor
    June 29th, 2009 at 01:40 | #5

    @Kevin Newman
    Hi. Yes. You will see bag if:

    http://www.yoursite.com/something?a=1&b=2#/something-anohter/?a=3&b=4

    In IE & Opera a = 1 and b = 2. Params get from first “?” symbol. My variant fix this problem .

  6. June 29th, 2009 at 10:26 | #6

    Egor, I added a ticket in google code for this, and will investigate soon. Thanks! :-)

    http://code.google.com/p/unfocus-history-keeper/issues/detail?id=7

  1. June 19th, 2008 at 02:05 | #1
  2. September 11th, 2008 at 13:52 | #2
  3. February 9th, 2009 at 10:21 | #3