Re: XMLHttpRequest for "HEAD" dumps "no element found" errors

Martin Honnen <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xml
Organization Liberty Development
Message-ID <[email protected]>

Michael Vincent van Rantwijk wrote:

> I use somehing like this:
> 
> var xmlhttp = new XMLHttpRequest();
> xmlhttp.open("HEAD", aURL, false);
> xmlhttp.onreadystatechange = function() {
>  if (xmlhttp.readyState == 4) {
>   return xmlhttp.getResponseHeader("Last-Modified");
>  }
> }
> xmlhttp.send(null);
> 
> and that works, but it throws JavaScript errors like this:
> 
> Error: [JavaScript Error: "no element found" {file: 
> "http://mozillazine.org/atom.xml" line: 1 column: 1 source: "
> ^"}]
> Source File: http://mozillazine.org/atom.xml
> Line: 1, Column: 1
> Source Code:
> ^

I have tried with Mozilla 1.7.11 and no errors happen, but when I try 
with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) 
Gecko/20050806 Firefox/1.0+ I see the error so it looks like a 
regression that happened on the trunk after 1.7. Although I don't know 
whether something has changed with XMLHttpRequest and HEAD requests or 
maybe only error reporting, lots of stuff nowadays ends up in the 
JavaScript console although it is not a script error.

Consider filing a bug on the issue and please post the bug number here.

-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.