innerHTML doesn't work in IE11 and IE8

后端 未结 3 971
没有蜡笔的小新
没有蜡笔的小新 2021-01-14 03:39

I use these codes for refreshing a part of my page :

var container = document.getElementById(\"mainForm:table_1\");
var content = container.innerHTML;
contai         


        
相关标签:
3条回答
  • 2021-01-14 04:23

    IE9 and below doesn't support pushState. For unsupported browsers use history API. and also find some more list of polyfills here.

    0 讨论(0)
  • 2021-01-14 04:24

    It seems IE 11 does not refresh an element if the new content set to its innerHTML is the same than its actual content.
    My problem was that in <img src='some_url'...> the 'some_url' string was the same even if its content was changed.
    To solve this I added milliseconds at the end of some_url so it becomes : <img src='some_url&time=' + new Date().getTime() ...>

    0 讨论(0)
  • 2021-01-14 04:36

    for first part of your question do this :

      var container = document.getElementById("mainForm:table_1").parentNode;
      var content = container.innerHTML
      container.innerHTML= content;
    

    and for second part of your question as @JITHIN PV said you must use history.js

    you can easily use it like this :

    var History = window.History;
    History.enabled ;
    History.pushState("object or string", "object or string", "object or string");
    
    0 讨论(0)
提交回复
热议问题