A
A
Artem2016-09-14 15:05:07
JavaScript
Artem, 2016-09-14 15:05:07

How to debug a website under IE?

Hello, dear inhabitants of the toaster.
In general, I had the task of ensuring the site works under IE9, which I, to my great anger, cannot install. I use ajax, work with DOM (appendChild()). The question arose how to ensure the work of ajax. I created XHR cross-browser according to the guide from the Internet. In chrome and FF everything works. The question is how to make it work in IE? I can't even open the debug panel, everything hangs.
I am attaching the ajax request code.

function send(){
 xhr = getXmlHttp();
    xhr.open('POST', 'index.php');
    xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xhr.onload = function() {
        if (xhr.status === 200) {
            active_element.setAttribute('value', xhr.responseText);
      alert('Данные успешно обновлены');
        } else if (xhr.status !== 200) {
            alert('Request failed.  Returned status of ' + xhr.status);
        }
    };
    xhr.send(data);
}

function getXmlHttp(){
  var ro;
   try {
       ro = new ActiveXObject("Msxml2.XMLHTTP");
   } catch (e) {
       try {
           ro = new ActiveXObject("Microsoft.XMLHTTP");
       } catch (f) {
           ro = null;
       }
   }
   if (!ro && typeof(XMLHttpRequest) != 'undefined') {
       ro = new XMLHttpRequest();
   }
  return ro;
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Ineshin, 2016-09-14
@IonDen

1. Use jQuery. There's a $.ajax method in there that's well tested.
2. Install a free virtual machine: https://developer.microsoft.com/en-us/microsoft-ed...
3. Use youmightnotneedjquery.com

D
Dmitry Belyaev, 2016-09-14
@bingo347

Chop https://polyfill.io/v2/docs/ and you can (almost) forget that there are browsers that don't follow the standards
Naturally, some new features like websockets, canvas, webworkers, fileapi, etc. are not polyfilled, although some can be emulated

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question