how to give xmlhttp request for netscape browser

  • Thread starter balakrishnan.dinesh
  • Start date
B

balakrishnan.dinesh

hi friends,

Exactly what i want to know is, In my product we are using
xmlhttp request to retrive some data from the server, And Im using IE
browser, its working fine in IE.
Now i want to work with netscape,I dont know how to pass the xmlhttp
request in Netscape. i got some code like below for netscape for
xmlhttp

var oXML=new XMLHttpRequest();
oXML.open("GET","http://google.com",false);
oXML.send(null);
document.write(oXML.responseText);

but its not woking, it shows some uncaught exception error.

So can u suggest me some code for xmlhttp request for Netscape,Im using
version 8.1 netscape browser.
 
I

Ian Collins

hi friends,

Exactly what i want to know is, In my product we are using
xmlhttp request to retrive some data from the server, And Im using IE
browser, its working fine in IE.
Now i want to work with netscape,I dont know how to pass the xmlhttp
request in Netscape. i got some code like below for netscape for
xmlhttp
The only significant difference between IE and decent browsers is how
you create the object:
var oXML=new XMLHttpRequest();
oXML.open("GET","http://google.com",false);
oXML.send(null);
document.write(oXML.responseText);

but its not woking, it shows some uncaught exception error.
Not surprised, it wouldn't work for IE like that either. Just create an
XMLHttpRequest object and use it as you currently do in IE.
 
B

balakrishnan.dinesh

yes i have done it too, atfer trying that only i came to do this code

var oXML=new XMLHttpRequest();
oXML.open("GET","http://google.com",false);
oXML.send(null);
document.write(oXML.responseText);

Netscape is not working for above code.and also its not working for ,
that what im used for IE browser for xmlhttpRequest.
 
M

Martin Honnen

var oXML=new XMLHttpRequest();
oXML.open("GET","http://google.com",false);

With the same origin policy you can only open connections to original
server your HTML document with the script came from.
Thus if your HTML document with the script comes from
http://example.com/ then you can open absolute URLs from
http://example.com/ or you can use relative URLs relative to
http://example.com/. You cannot however open connections to
http://google.com/. With normal security settings IE does not allow that
for the internet zone either so I assume you code working for IE is run
with lowerered security settings.
 
I

Ian Collins

yes i have done it too, atfer trying that only i came to do this code
Done what? Please do me the courtesy of quoting my message in your
response.
var oXML=new XMLHttpRequest();
oXML.open("GET","http://google.com",false);
oXML.send(null);
document.write(oXML.responseText);

Netscape is not working for above code.and also its not working for ,
that what im used for IE browser for xmlhttpRequest.
What isn't working?
 
R

RobG

yes i have done it too, atfer trying that only i came to do this code

var oXML=new XMLHttpRequest();
oXML.open("GET","http://google.com",false);
oXML.send(null);
document.write(oXML.responseText);

Netscape is not working for above code.and also its not working for ,
that what im used for IE browser for xmlhttpRequest.

Use a library, it will fix your IE and other browser woes:

<URL:http://www.ajaxtoolbox.com/>


But you may be stymied by the same-origin (security) policy as noted in
other replies.
 
B

balakrishnan.dinesh

Hi Collins ,
Ill tell u clearly now,
Now in my product ,I have to retirve some data from the server, for
that im using xmlhttp request function in IE browser
the xmlhttp request function is given below

function RequestThroughXmlhttp(req)
{
/* These lines are common for all the xmlhttp request */
var xmlhttp,a;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
xmlhttp = new XMLHttpRequest();
if(!xmlhttp)
return;

/* Common Code ends here */

xmlhttp.open("POST", req , false);
xmlhttp.setRequestHeader("Content-Type","text/html")
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4)
{
if (xmlhttp.status == 200)
{
a = xmlhttp.responseText;
//alert(a);
}
else
if (xmlhttp.status != 200)
{ alert("Resource Not Available");
return;}
}
else
return;
}
xmlhttp.send();
xmlhttp.close;
return a;
}

this is function im using for xmlhttp request. In IE browser the above
funtion is working very fine.
but when i go to Netscape browser , this function is not
working to do xmlhttp request. so after that i searched and get some
code for xmlhttp request through some website for netscape browser.
that code is below

var oXML=new XMLHttpRequest();
oXML.open("GET","http://google.com",false);
oXML.send(null);
document.write(oXML.responseText);

but unfortunatly the above code is also not working on Netscape browser
for xmlhttp request.

So there is no problem with IE browser, Problem only with Netscape
only.

what i exactly need is ,I want a xmlhttp request code for netscape
browser.

Thank u

Rgrds...

Dinesh
 
I

Ian Collins

Hi Collins ,
Ill tell u clearly now,
Now in my product ,I have to retirve some data from the server, for
that im using xmlhttp request function in IE browser
the xmlhttp request function is given below

function RequestThroughXmlhttp(req)
{
/* These lines are common for all the xmlhttp request */
var xmlhttp,a;
just add

if( window.XMLHttpRequest ) // Mozilla, Safari,...
{
xmlhttp = new XMLHttpRequest();
}
else
{
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
xmlhttp = new XMLHttpRequest();
if(!xmlhttp)
return;

/* Common Code ends here */
}

Also Please quote context next time.
 
B

balakrishnan.dinesh

hi collins

After modifing the code also,the xmlhttp is not working. Is there any
need to change any browser setting for Netscape for xmlhttp.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top