history.js icon indicating copy to clipboard operation
history.js copied to clipboard

Backbutton doesn't triggers the statechange binded event in IE8

Open Cheprer opened this issue 10 years ago • 0 comments

I got slight problem with back compability, just for IE8(testing throught the emulator in the new IE version of debugger) exclusively but not tested on other HTML4 browsers. The HTML5 browsers and IE9 and higher works fine, triggers the function to the binded event when that event occurs of course.

When I call normally push state by the History.pushState function the binded function/event triggers because it's correct the state changed, I got my way to handle this but when I press back button or forward button the event is not triggered. I'm using the jquery html4/html5 version of history.js file.

My code to bind the statechange is below. Any thoughts where could be mistake? or is it mistake in the history.js file? Anyway some solution would be nice.

window.History.Adapter.bind(window, 'statechange', function () {
    var state = window.History.getState();
    if (window.location.href.indexOf("FileList.aspx") > -1 && typeof $fileManager != "undefined") {

        if (!$fileManager.StateJustAdded) {
            $fileManager.historyMovement = true;
            if (state != null) {
                $fileManager.navigate(state.data.id);
            }
            $fileManager.historyMovement = false;
            $fileManager.StateJustAdded = false;
        }
        else if ($fileManager.StateJustAdded) {
            $fileManager.StateJustAdded = false;
        }
    }
});

Cheprer avatar Jan 26 '15 10:01 Cheprer