Title: Firefox 1.5, XmlHttpRequest, req.responseXML and document.domain
Author: Alex Kirk
Published: July 27, 2006
Last modified: June 21, 2007

---

# Firefox 1.5, XmlHttpRequest, req.responseXML and document.domain

July 27, 2006

Recently I have been working on a web application, extending it with an iframe on
another subdomain.

When you set up communication with an iframe on another subdomain, it works by setting
document.domain in both pages. Pretty nice and straight forward.
 But it can mess
up the rest of your page.

As soon as you have set document.domain you should be able to do an XHR to your 
original domain according to the same domain policy.

This will work in IE, Safari, and Opera.
 This will **not** work in Firefox 1.0.
This is very awkward but at least it has been [fixed in 1.5](https://bugzilla.mozilla.org/show_bug.cgi?id=290100).
So it will work in Firefox 1.5. **But:**

The responseXML object is useless. You can’t access it, you receive a Permission
Denied when trying to access it’s content (e.g. documentElement). Very annoying.

Even stranger that responseText is still readable. What’s the reason for this? Is
there some security risk i am unaware of or is it a plain bug?

As the responseText is available there is a pretty simple fix: re-parse the XML,
which is kinda stupid and cpu intense if you have a lot of them. (something like:
var doc =
 (new DOMParser()).parseFromString(req.responseText, "text/xml");)

I have some [sample code available here](https://alex.kirk.at/cross_subdomain_iframe/?output_format=md).

Apparently a [bug report has been filed at 1.5.0.1](https://bugzilla.mozilla.org/show_bug.cgi?id=326337).
No response from developers. Great.
 Unfortunately it has only been filed for OSX,
but it also afffects Windows Firefox.

Mozilla guys, fix this ASAP.

**Update 2007-06-21:** Things seem to start moving, we will likely [have a fix](https://bugzilla.mozilla.org/show_bug.cgi?id=326337)
for Firefox 3.

firefox bug, document.domain, XmlHttpRequest, responseXML

[Ajax](https://alex.kirk.at/category/code/ajax/)

Read this next

[Misuse of the Array Object in JavaScript](https://alex.kirk.at/2006/05/18/misuse-of-the-array-object-in-javascript/)

## 2 responses to “Firefox 1.5, XmlHttpRequest, req.responseXML and document.domain”

 1.  [Ajaxian » Pains of document.domain in FireFox 1.5](http://ajaxian.com/archives/pains-of-documentdomain-in-firefox-15)
 2.  [July 27, 2006](https://alex.kirk.at/2006/07/27/firefox-15-xmlhttprequest-reqresponsexml-and-documentdomain/comment-page-1/#comment-3959)
 3.  […] Alexander Kirk has written about a problem with XHR, responseXML and document.
     domain in FireFox: […]
 4.  [Log in to Reply](https://alex.kirk.at/wp-login.php?redirect_to=https%3A%2F%2Falex.kirk.at%2F2006%2F07%2F27%2Ffirefox-15-xmlhttprequest-reqresponsexml-and-documentdomain%2F)
 5.  ![Thomas Einwaller Avatar](https://secure.gravatar.com/avatar/d63894341ef2525869073e82e1b595d9189e0672516fde09879820323087ab5b?
     s=48&d=mm&r=g)
 6.  [Thomas Einwaller](http://tompson.wordpress.com/)
 7.  [July 31, 2006](https://alex.kirk.at/2006/07/27/firefox-15-xmlhttprequest-reqresponsexml-and-documentdomain/comment-page-1/#comment-4085)
 8.  This IS a Firefox bug. Though the repsonse content type is set to “text/xml” Firefox
     does not allow you to access responseXML if document.domain is set.
 9.  I tried overrideMimeType(“text/xml”) too but that did not help.
 10. The only thing that works is to parse the xml again like kirk describes it.
 11. [Log in to Reply](https://alex.kirk.at/wp-login.php?redirect_to=https%3A%2F%2Falex.kirk.at%2F2006%2F07%2F27%2Ffirefox-15-xmlhttprequest-reqresponsexml-and-documentdomain%2F)

### Leave a Reply 󠀁[Cancel reply](https://alex.kirk.at/2006/07/27/firefox-15-xmlhttprequest-reqresponsexml-and-documentdomain/?output_format=md#respond)󠁿

Only people in [my network](https://alex.kirk.at/friends/) can comment.

This site uses Akismet to reduce spam. [Learn how your comment data is processed.](https://akismet.com/privacy/)