Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Cross browser compatiblity issue with XMLHTTPRequest
Old 02-05-2009, 05:48 AM Cross browser compatiblity issue with XMLHTTPRequest
EdB
Skilled Talker

Posts: 79
Name: Ed Barnett
Trades: 0
Hi everyone,

I've got the following code successfully working in IE7 but it doesn't work in Firefox, Opera or Safari. Can anyone help at all? (This is our new company site and I can't afford for users to come to the site using non-IE browsers and have issues). I will of course be creating Ajax free alternatives to these pages but hope I can get it working.

function getXMLHTTPRequest() {
var request = false;
try {
request = new XMLHTTPRequest(); /* e.g. Firefox */
}
catch (err1) {
try {
request = new ActiveXObject("Msxm12.XMLHTTP"); /* Some IE Versions */
}
catch (err2) {
try {
request = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (err3) {
request = false;
}

}
}
return request;
}
EdB is offline
Reply With Quote
View Public Profile Visit EdB's homepage!
 
 
Register now for full access!
Old 02-05-2009, 12:15 PM Re: Cross browser compatiblity issue with XMLHTTPRequest
spyderwebtech's Avatar
Skilled Talker

Posts: 51
Trades: 0
Consider using an AJAX library like JQuery for AJAX calls. They have taken a tremendous amount of time making cross-browser issues a thing of the past.

Just include the library and use one line of code
Code:
$.get(url, returnfunction)
and you are done.
spyderwebtech is offline
Reply With Quote
View Public Profile
 
Old 02-09-2009, 06:00 AM Re: Cross browser compatiblity issue with XMLHTTPRequest
EdB
Skilled Talker

Posts: 79
Name: Ed Barnett
Trades: 0
Thanks for the advise I'll give it a go shortly
EdB is offline
Reply With Quote
View Public Profile Visit EdB's homepage!
 
Reply     « Reply to Cross browser compatiblity issue with XMLHTTPRequest
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.17504 seconds with 12 queries