fochie wrote:
[color=blue]
> I'm having a problem when I try to GET a file from my server
> via xmlhttp when using Mozilla. With IE I can get any type of file
> fine, get/display headers fine, etc. With Mozilla, using the same
> HTML/JS it always returns no data (xmlhttp.responseText is null).
>
> When I try to get headers using Mozilla or display the http status code
> I get some obscure exception in the javascript console that I've given
> up on searching for an answer to ....
>
> Error: [Exception... "Component returned failure code: 0x80040111
> (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult:
> "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame ::
>
http://myserver.com/xmlhttp.html? :: RSchange :: line 26" data: no]
> Source File:
http://myserver.com/xmlhttp.html?
> Line: 26[/color]
Which line exactly is that line 26, how does the code in that line look
when you get that error message?
Are you using frames or popup windows?
[color=blue]
> I've tried coding my test app many ways based on the examples out there
> and haven't been able to get it to run in Mozilla/FF yet.
>
> If I do an alert on xmlhttp.responseText I get a blank alert pop up, if
> I alert xmlhttp.responseText.length it's always zero using Mozilla.
> Both alerts always work with the same HTML/JS when running in IE.
>
> Beginning to think maybe I'm lacking something on the server side
> related to Content-type being sent back that IE allows and Mozilla
> doesn't(?)
>
> Any assistance at this point would be greatly appreciated.
>
> Thanks !
> Steve
>
> Here's a simple example that works in IE but returns null for
> responseText in Mozilla when I run it ...
>
> <HTML>
> <HEAD>
> <SCRIPT LANGUAGE="JAVASCRIPT" type="text/javascript">
> <!--
> var xmlhttp=false;
> /*@cc_on @*/
> /*@if (@_jscript_version >= 5)
> // JScript gives us Conditional compilation, we can cope with old IE
> versions.
> // and security blocked creation of the objects.
> try {
> xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
> } catch (e) {
> try {
> xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
> } catch (E) {
> xmlhttp = false;
> }
> }
> @end @*/
> if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
> xmlhttp = new XMLHttpRequest();
> }
>
> function RSchange() {
> if (xmlhttp.readyState==4) {
> //if (xmlhttp.status == 200) {
> //alert(xmlhttp.statusText); // this line chokes in Mozilla
> alert(xmlhttp.responseText); //empty alert box using Moz
> // }
> }
> }
>
> function go() {
> if (xmlhttp) {
> xmlhttp.open("GET", "http://myserver.com/index.html", true);[/color]
Is
http://myserver.com/index.html on the same server as the HTML
document with the script? What content type does the server deliver
index.html with?
--
Martin Honnen
http://JavaScript.FAQTs.com/