Firefox と Chrome では、オブジェクトdocumentURI
を使用して作成された場合、XML DOM のドキュメント ノード オブジェクトのプロパティは DOM の URI を返しXMLHTTPRequest
ます。
Internet Explorer DOM に同等のプロパティはありますか? もしそうなら、それは何ですか? 、、およびプロパティはすべてdocumentURI
、null または未定義のいずれかを返します。url
URL
baseURI
プロパティのMSXML ドキュメントは、url
これが DOM を作成した HTTP リクエストで使用された URL を返すことを期待させましたが、与えられた例ではXMLHTTPRequest
.
DOM を作成し、プロパティをテストするために使用したコードは次のとおりです。
function getXslDom(url) {
if (typeof XMLHttpRequest == "undefined") {
XMLHttpRequest = function () {
return new ActiveXObject("Msxml2.XMLHTTP.6.0");
};
}
var req = new XMLHttpRequest();
req.open("GET", url, false);
req.send(null);
var status = req.status;
if (status == 200 || status == 0) {
return req.responseXML;
} else {
throw "HTTP request for " + url + " failed with status code: " + status;
}
};
var xslDom = getXslDom('help.xsl');
// the following shows "undefined" for IE
window.alert(xslDom.documentURI);