4

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

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

container.innerHTML worked well in firefox and chrome but it doesn't work in IE8 and IE11

I've read these links : .InnerHTML Not working properly in Internet Explorer and document.getElementById().innerHTML fails with 'Unknown Error' in IE

but my problem is that I can't change the other part of my code easily due to of dynamically generation.

1) Is there any way that I can do just with these part of my code to solve IE problem ?

2) and also i need an alternative for :

window.history.pushState()

which doesn't work in IE8 and IE9

2
  • Going to guess that mainForm:table_1 is a <table> element? If so, try selecting a parent element of the table and replace the entire table. Commented Sep 22, 2014 at 8:15
  • yes you are right , it is a table . I try to do that and how about second part of my question ? how can I add a string to url with something like pushstate that work with ie8 and ie9 too ? thanks for your answer Commented Sep 22, 2014 at 8:43

2 Answers 2

6

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

Sign up to request clarification or add additional context in comments.

2 Comments

yes you are right it doesn't work, but isn't any way to do so with native javascript or jquery ? with out using history API
@OmiD You could just stop supporting outdated/obsolete browsers. It's time we stopped pandering to people who refuse to update - especially since doing so pretty much requires manually and deliberately (and therefore, maliciously to us) disabling Windows Update.
2

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");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.