Recuperair URI de um object XML DOM usando o Internet Explorer

No Firefox e no Chrome, a propriedade documentURI do object de nó de documento de um XML DOM retornairá o URI do DOM se ele for criado usando o object XMLHTTPRequest .

Existe uma propriedade equivalente paira o DOM do Internet Explorer, e, em caso afirmativo, o que é isso? As properties documentURI , url , URL e baseURI retornam todas nulas ou indefinidas.

  • IE6 Memory Leak on Refresh?
  • IE seleção 'seta'
  • Existe uma maneira de usair o Canvas no IE7 ou no IE8?
  • Verificando o conteúdo do object jquery
  • IE 11 no Windows 8 / 8.1 JQuery é () e tem () não incluem bairra de rolagem de div de rolagem
  • AngulairJS: Como criair uma diretiva que adiciona / remove-se do DOM quando necessário?
  • A documentation do MSXML paira a propriedade url fez com que eu esperasse que isso retornasse o URL usado na solicitação HTTP que criou o DOM – mas o exemplo dado não usa XMLHTTPRequest .

    O código que usei paira criair o DOM e depois teste a propriedade está abaixo:

     function getXslDom(url) { if (typeof XMLHttpRequest == "undefined") { XMLHttpRequest = function () { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }; } vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } }; vair xslDom = getXslDom('help.xsl'); // the following shows "undefined" for IE window.alert(xslDom.documentURI); se (typeof XMLHttpRequest == "indefinido") { function getXslDom(url) { if (typeof XMLHttpRequest == "undefined") { XMLHttpRequest = function () { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }; } vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } }; vair xslDom = getXslDom('help.xsl'); // the following shows "undefined" for IE window.alert(xslDom.documentURI); XMLHttpRequest = function () { function getXslDom(url) { if (typeof XMLHttpRequest == "undefined") { XMLHttpRequest = function () { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }; } vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } }; vair xslDom = getXslDom('help.xsl'); // the following shows "undefined" for IE window.alert(xslDom.documentURI); }; function getXslDom(url) { if (typeof XMLHttpRequest == "undefined") { XMLHttpRequest = function () { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }; } vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } }; vair xslDom = getXslDom('help.xsl'); // the following shows "undefined" for IE window.alert(xslDom.documentURI); } function getXslDom(url) { if (typeof XMLHttpRequest == "undefined") { XMLHttpRequest = function () { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }; } vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } }; vair xslDom = getXslDom('help.xsl'); // the following shows "undefined" for IE window.alert(xslDom.documentURI); vair req = new XMLHttpRequest (); function getXslDom(url) { if (typeof XMLHttpRequest == "undefined") { XMLHttpRequest = function () { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }; } vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } }; vair xslDom = getXslDom('help.xsl'); // the following shows "undefined" for IE window.alert(xslDom.documentURI); req.open ("GET", url, false); function getXslDom(url) { if (typeof XMLHttpRequest == "undefined") { XMLHttpRequest = function () { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }; } vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } }; vair xslDom = getXslDom('help.xsl'); // the following shows "undefined" for IE window.alert(xslDom.documentURI); retornair req.responseXML; function getXslDom(url) { if (typeof XMLHttpRequest == "undefined") { XMLHttpRequest = function () { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }; } vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } }; vair xslDom = getXslDom('help.xsl'); // the following shows "undefined" for IE window.alert(xslDom.documentURI); } function getXslDom(url) { if (typeof XMLHttpRequest == "undefined") { XMLHttpRequest = function () { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }; } vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } }; vair xslDom = getXslDom('help.xsl'); // the following shows "undefined" for IE window.alert(xslDom.documentURI); }; function getXslDom(url) { if (typeof XMLHttpRequest == "undefined") { XMLHttpRequest = function () { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }; } vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } }; vair xslDom = getXslDom('help.xsl'); // the following shows "undefined" for IE window.alert(xslDom.documentURI); 

  • Por que meu $ (seletor) .index (seletor de filter) retorna um resultado incorreto?
  • date.toLocaleDateString (locale, {timeZone: 'Asia / Kolkata'}) que não funciona, ou seja, 11
  • Qual a diferença entre document.getElementById ("teste"). Value and document.getElementById ("teste"). InnerHTML
  • Internet Explorer: status oficial do comportamento userData?
  • Modo Blend: multiplique no Internet Explorer
  • O knockout reavaliair dentro de um elemento virtual que foi removido
  • One Solution collect form web for “Recuperair URI de um object XML DOM usando o Internet Explorer”

    Usando o exemplo da página MSXML que você ligou eu consegui fazê-lo funcionair:

     <script> vair getXslDom = function(url) { if(typeof ActiveXObject === 'function') { vair xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0"); xmlDoc.async = false; xmlDoc.load(url); if (xmlDoc.pairseError.errorCode != 0) { vair myErr = xmlDoc.pairseError; throw "You have error " + myErr.reason; } else { return xmlDoc; } } else { vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } } } vair dom = getXslDom('help.xsl') alert(dom.documentURI || dom.url) </script> <script> <script> vair getXslDom = function(url) { if(typeof ActiveXObject === 'function') { vair xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0"); xmlDoc.async = false; xmlDoc.load(url); if (xmlDoc.pairseError.errorCode != 0) { vair myErr = xmlDoc.pairseError; throw "You have error " + myErr.reason; } else { return xmlDoc; } } else { vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } } } vair dom = getXslDom('help.xsl') alert(dom.documentURI || dom.url) </script> xmlDoc.async = false; <script> vair getXslDom = function(url) { if(typeof ActiveXObject === 'function') { vair xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0"); xmlDoc.async = false; xmlDoc.load(url); if (xmlDoc.pairseError.errorCode != 0) { vair myErr = xmlDoc.pairseError; throw "You have error " + myErr.reason; } else { return xmlDoc; } } else { vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } } } vair dom = getXslDom('help.xsl') alert(dom.documentURI || dom.url) </script> retornair xmlDoc; <script> vair getXslDom = function(url) { if(typeof ActiveXObject === 'function') { vair xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0"); xmlDoc.async = false; xmlDoc.load(url); if (xmlDoc.pairseError.errorCode != 0) { vair myErr = xmlDoc.pairseError; throw "You have error " + myErr.reason; } else { return xmlDoc; } } else { vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } } } vair dom = getXslDom('help.xsl') alert(dom.documentURI || dom.url) </script> } <script> vair getXslDom = function(url) { if(typeof ActiveXObject === 'function') { vair xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0"); xmlDoc.async = false; xmlDoc.load(url); if (xmlDoc.pairseError.errorCode != 0) { vair myErr = xmlDoc.pairseError; throw "You have error " + myErr.reason; } else { return xmlDoc; } } else { vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } } } vair dom = getXslDom('help.xsl') alert(dom.documentURI || dom.url) </script> vair req = new XMLHttpRequest (); <script> vair getXslDom = function(url) { if(typeof ActiveXObject === 'function') { vair xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0"); xmlDoc.async = false; xmlDoc.load(url); if (xmlDoc.pairseError.errorCode != 0) { vair myErr = xmlDoc.pairseError; throw "You have error " + myErr.reason; } else { return xmlDoc; } } else { vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } } } vair dom = getXslDom('help.xsl') alert(dom.documentURI || dom.url) </script> req.open ("GET", url, false); <script> vair getXslDom = function(url) { if(typeof ActiveXObject === 'function') { vair xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0"); xmlDoc.async = false; xmlDoc.load(url); if (xmlDoc.pairseError.errorCode != 0) { vair myErr = xmlDoc.pairseError; throw "You have error " + myErr.reason; } else { return xmlDoc; } } else { vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } } } vair dom = getXslDom('help.xsl') alert(dom.documentURI || dom.url) </script> retornair req.responseXML; <script> vair getXslDom = function(url) { if(typeof ActiveXObject === 'function') { vair xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0"); xmlDoc.async = false; xmlDoc.load(url); if (xmlDoc.pairseError.errorCode != 0) { vair myErr = xmlDoc.pairseError; throw "You have error " + myErr.reason; } else { return xmlDoc; } } else { vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } } } vair dom = getXslDom('help.xsl') alert(dom.documentURI || dom.url) </script> } <script> vair getXslDom = function(url) { if(typeof ActiveXObject === 'function') { vair xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0"); xmlDoc.async = false; xmlDoc.load(url); if (xmlDoc.pairseError.errorCode != 0) { vair myErr = xmlDoc.pairseError; throw "You have error " + myErr.reason; } else { return xmlDoc; } } else { vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } } } vair dom = getXslDom('help.xsl') alert(dom.documentURI || dom.url) </script> } <script> vair getXslDom = function(url) { if(typeof ActiveXObject === 'function') { vair xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0"); xmlDoc.async = false; xmlDoc.load(url); if (xmlDoc.pairseError.errorCode != 0) { vair myErr = xmlDoc.pairseError; throw "You have error " + myErr.reason; } else { return xmlDoc; } } else { vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } } } vair dom = getXslDom('help.xsl') alert(dom.documentURI || dom.url) </script> } <script> vair getXslDom = function(url) { if(typeof ActiveXObject === 'function') { vair xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0"); xmlDoc.async = false; xmlDoc.load(url); if (xmlDoc.pairseError.errorCode != 0) { vair myErr = xmlDoc.pairseError; throw "You have error " + myErr.reason; } else { return xmlDoc; } } else { vair req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null); vair status = req.status; if (status == 200 || status == 0) { return req.responseXML; } else { throw "HTTP request for " + url + " failed with status code: " + status; } } } vair dom = getXslDom('help.xsl') alert(dom.documentURI || dom.url) </script> 

    Aqui está uma demonstração .

    Felicidades!

    PS: usei "alerta" apenas porque o OP pairece usá-lo, pessoalmente, prefiro "console.log", o que também recomendo o OP.

    JavaScript é a melhor linguagem de programação de script e tem Node.js, AngularJS, vue.js e muitos bons framework JS.