devote / HTML5-History-API

HTML5 History API expansion for browsers not supporting pushState, replaceState
http://spb-piksel.ru
MIT License
1.02k stars 182 forks source link

Property history.state is not supported #95

Open sonic16x opened 8 years ago

sonic16x commented 8 years ago

Hi. In Android 4.0.3 on Android Browser is not support property history.state. Information from here _008

Not everything that supports methods history.replaceState and history.pushState, has a property history.state support.

Can you fix it ? You can make it using this code.

if (typeof window.history.state == 'undefined') {
  var originReplace = history.replaceState;

  window.history.replaceState = function(state, title, path) {
    window.history.state = state;
    originReplace.call(window.history, state, title, path);
  };

  var originPush = window.history.pushState;

  window.history.pushState = function(state, title, path) {
    window.history.state = state;
    originPush.call(window.history, state, title, path);
  };
}

Thanks.