jQuery History is now on Github

I created a fork of jQuery History plugin on Github.

Though this is just a fork for now, Mikage Sawatari, the original author of this plugin, and I agreed that it could be the mainstream in the near future.

I’ve already done some major changes to the script structure:

  • It no longer uses the Webkit-specific hack for updating the location object, because recent versions of Webkit can correctly update the object just like Firefix and IE8.
  • Hashes are percent-encoded with encodeURIComponent before being put to location.hash. So you can use any characters such as `?’ in your hash.
  • history.load does not execute the callback unless hash is changed.
  • Updated API/code format. Thanks to Kevin Dalman.

It works on IE6, IE7, IE8, Firefox3, Safari4, Chrome4, and Chrome5.

If you have any problems or feature requests, please create a new issue in the ITS. And of course, you can create your own fork.


jQuery Historyプラグインは今後Githubで管理されることになりました。

Mikage Sawatariさんによる元々のバージョンに対し、次のような大きな変更が加えられています。

  • Webkitで動かすためのハックは不要になったので取り除かれました。
  • location.hash に代入する前に encodeURIComponent によるパーセントエンコーディングを行うようにしました。これによって ? を含むあらゆる文字を hash として保存できるようになりました。
  • ハッシュが変更されていない場合はコールバックが実行されないようになりました。
  • API/コーディングスタイルを変更しました。この変更はフォーラムのKevin Dalman氏の投稿に依ります。

IE6, IE7, IE8, Firefox3, Safari4, Chrome4, Chrome5で動作します。

Githubのバグトラッキングシステムに登録してください。もちろん自分でforkを作って修正していただいても構いません。

3 Responses

  1. [...] jQuery History is now on Github. Please check it. [...]

  2. Timmo より:

    $.history.init(function(hash){
    if (!hash) hash = “default”;
    $(“#content”).load(hash+”.html”);
    });

    Contact

    Did you know this is enough code to make it work? There is no need for a function when you click on the contact link. Also history is working fine this way. I don’t know if this is supposed to work this way but it does. It’s less code than your example.
    You onlu have to initialize the plugin and you’re ready to go!

  3. tkyk より:

    Hi, Timmo.

    Your code will not work on IE6, IE7, and IE8 compatiblity mode, because this plugin uses some tricks to keep histories on these browsers. So $.history.load is necessary.

Leave a Reply