Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internet Explorer 11 causes Access Denied error in OpenLayers.Format.XML #1177

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Potential fix for IE xml parsing errors
  • Loading branch information
ahocevar committed Mar 6, 2014
commit ad1c9fc67bd245ef32be1ebf3e99ca0c83f260da
14 changes: 10 additions & 4 deletions lib/OpenLayers/Format/XML.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, {
* the object.
*/
initialize: function(options) {
if(window.ActiveXObject) {
this.xmldom = new ActiveXObject("Microsoft.XMLDOM");
if (!(document.implementation &&
document.implementation.createDocument) &&
typeof ActiveXObject != 'undefined') {
this.xmldom = new ActiveXObject("MSXML2.DOMDocument");
this.xmldom.setProperty('ProhibitDTD', true);
}
OpenLayers.Format.prototype.initialize.apply(this, [options]);
// clone the namespace object and set all namespace aliases
Expand Down Expand Up @@ -138,8 +141,11 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, {
* Since we want to be able to call this method on the prototype
* itself, this.xmldom may not exist even if in IE.
*/
if(window.ActiveXObject && !this.xmldom) {
xmldom = new ActiveXObject("Microsoft.XMLDOM");
if(!(document.implementation &&
document.implementation.createDocument) &&
typeof ActiveXObject != 'undefined') {
this.xmldom = new ActiveXObject("MSXML2.DOMDocument");
this.xmldom.setProperty('ProhibitDTD', true);
} else {
xmldom = this.xmldom;

Expand Down