2

I am using window.History.pushstate. It works fine in Chrome, but in IE8 it appends the path #. Please help.

Below is my code snippet:

  var History = window.History; 
  History.pushState(null, null, "/abc"); 
Paul D. Waite
  • 96,640
  • 56
  • 199
  • 270
user3433077
  • 31
  • 1
  • 1
  • 2
  • 4
    [`window.History` isn’t supported in IE 8 (or, indeed, IE9](http://caniuse.com/#feat=history). – Paul D. Waite Mar 18 '14 at 12:37
  • 1
    **window.History** and **window.history** is not the same thing. window.history uses the HTML5 history API which ie8 can't use. window.History referes to History.js (see https://github.com/browserstate/history.js by Benjamin Lupton). History.js is almost the same as HTML5 History API only with fallback mechanisms for HTML4 only supported browsers. – Avec Apr 14 '14 at 09:28

2 Answers2

2

You wrote window.History. Did you include history.js by Benjamin Lupton? window.History and window.history is not the same thing as window.History referes to history.js and that makes the history backwards compatible with html4 browsers.

Take a look at these two:

Community
  • 1
  • 1
Avec
  • 1,626
  • 21
  • 31
1

you can refer below answer

IE history push state

IE9 and below don't support pushState. You have an exception when calling the following line:

window.history.pushState(null, null, pathFullPage);

SCRIPT438: Object doesn't support property or method 'pushState' ?terms_and_conditions, line 62 character 21

You may probably be interested in looking at some workarounds discussed here: Emulate/polyfill history.pushstate() in IE

Community
  • 1
  • 1
Neel
  • 11,625
  • 3
  • 43
  • 61
  • 1
    ”you can refer below answer given by Sergei Grebnov” — what answer is that? – Paul D. Waite Mar 18 '14 at 12:39
  • @RokoC.Buljan: aha! I see. – Paul D. Waite Mar 18 '14 at 12:40
  • I have taken the answer from another answer but I have given the name of the person who has given it..i don't think it is wrong!! – Neel Mar 18 '14 at 12:41
  • @PaulD.Waite cause Grebnov is a SO user – Roko C. Buljan Mar 18 '14 at 12:41
  • 1
    @Neel: if the question is a duplicate of another question, it should be marked as a duplicate. Could you link to where you got the answer from? – Paul D. Waite Mar 18 '14 at 12:42
  • oh common I have read SO rules and its clearly mentioned that u can write another person answers but just mention the name of the author and I have done the same and ur behaving so rude to me it is sad believe me! – Neel Mar 18 '14 at 12:44
  • ok sorry @RokoC.Buljan I will never refer like I did today but I don't think I am wrong I just wanted to help!! tc – Neel Mar 18 '14 at 12:46
  • @PaulD.Waite the above comment for u also – Neel Mar 18 '14 at 12:47
  • @Neel ok ok just making sure. Nothing personal, we have already collected too many duplicates here on SO (I'm also one that sometimes answers dupes but I try to always give an extra note and fresh value) but sometimes we see exact duplicates without giving credit to the OP. and that's bad :) happy coding! – Roko C. Buljan Mar 18 '14 at 12:48
  • 1
    @RokoC.Buljan yes my mistake I will take care from next time..happy coding and no offence :) – Neel Mar 18 '14 at 12:49