0

Im trying to fetch the html markup from a response and trying to override with current page to do some form submissions.

When i use document.write in chrome.. its fetching and overriding current html markup. But IE is showing blank screen, looks like document.write is not supported by IE.

 fetch('http://www.mocky.io/v2/5b2948502f00005b00f56127')
    .then(function(response) {
      return response.text();
    })
    .then(function(myJson) {
  document.write(myJson)
   })

Could you please provide me a fix or a polyfill to be installed in our react application

Sumanth madey
  • 389
  • 1
  • 6
  • 14
  • 2
    Don't use `document.write()` in asynchronous callbacks. By the time the AJAX call completes, the DOM will have been completed. Then calling `document.write()` will clear the DOM. – Barmar Jun 19 '18 at 19:50
  • Are you using a fetch polyfill for Internet Explorer? (https://github.com/github/fetch). – Matt Shirley Jun 19 '18 at 19:51
  • document.write can overwrite entire page, not recommend to use – Chase Jun 19 '18 at 20:03

0 Answers0