473,491 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

AJAX problem on IE7

16 New Member
Hello,

I'm having problem implementing AJAX on IE7. In other browser it works totally fine. In IE7, if i enable the Enable Native XMLHTTP support, everything just went wrong.

Here is the XMLHTTP request code : (thanks to www.masykur.web.id)

----------------
Expand|Select|Wrap|Line Numbers
  1.  http_request = false ;
  2.         if (window.XMLHttpRequest) { 
  3.             http_request = new XMLHttpRequest();
  4.             if (http_request.overrideMimeType) {
  5.                 http_request.overrideMimeType('text/xml');
  6.  
  7.             }
  8.         } else if (window.ActiveXObject) { // IE
  9.             var aVersions = [ "MSXML2.XMLHttp.6.0", "MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0", "MSXML2.XMLHttp.3.0", "Microsoft.XMLHTTP" ];
  10.             for (var i = 0; i < aVersions.length; i++) {
  11.                 try { http_request = new ActiveXObject(aVersions[i]);
  12.                     break;
  13.                 }
  14.                 catch (e)
  15.                 {
  16.                 // Do nothing 
  17.                 } 
  18.             }
  19.         }
------------

But if i disable the Enable Native XMLHTTP support, it just run smoothly.
I've read from several forums that this problem is quite common, but i just can't find out the work-around.


How do i overcome this problem?
Since out there i can't tell the IE7 user to 'disable their XMLHTTP native'.
Btw, i guess in IE6 there's no problem at all.

Thanks...
Oct 21 '08 #1
1 5468
Dormilich
8,658 Recognized Expert Moderator Expert
some ways I would try to solve this:
- try-catch on both objects
- try the ActiveXObject first

this one is working fine for me:
Expand|Select|Wrap|Line Numbers
  1.     try {
  2.         request = new XMLHttpRequest();
  3.     }
  4.     catch (e){
  5.         try {
  6.             request = new ActiveXObject("Msxml2.XMLHTTP"); // IE 5
  7.         } catch (e) {
  8.             try {
  9.                 request = new ActiveXObject("Microsoft.XMLHTTP"); // IE 6
  10.             } catch (e) {
  11.                 alert("...your error message here...");
  12.                 return false;
  13.             }
  14.         }
  15.     }
must proceed, will check later

regards
Oct 21 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

11
2315
by: Yarco | last post by:
I want to use "Ajax" to create my web for hobby. But i don't know whether "Ajax" is mature... And what about with php? Someone have experience on it? ....
4
4283
by: bobzimuta | last post by:
I'm creating a simple AJAX library. It's an object that will return an array containing the response text or xml. I'm trying to find a way to assign the response as a property of the object, but...
0
1822
by: melledge | last post by:
Ajax Developers' Day added to XTech 2006 agenda XTech 2006 - 17-19 May - Hotel Grand Krasnopolsky - Amsterdam, The Netherlands
0
1804
by: melledge | last post by:
Ajax Developers' Day to Kick Off XTech 2006 Conference Industry experts offer insight into next generation of the Web ALEXANDRIA, VIRGINIA, USA - April 25, 2006 - In response to the rapidly...
1
16469
by: www.web20developers.com | last post by:
http://www.web20developers.com http://www.web20developers.com/index.php?option=com_content&task=view... Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell AJAX -...
10
3011
by: =?Utf-8?B?WWFua2VlIEltcGVyaWFsaXN0IERvZw==?= | last post by:
controlsPlease could some of you here post some of your live examples of AJAX (esp drag panels, collapsable panels, and popup menu.) (It's one thing to talk about how great something is, but it's...
2
2244
by: soni2926 | last post by:
hi, does anyone know of any good books on ajax and asp.net, one that teaches ajax itself before jumping in atlas? I wanted to get an understanding of ajax and how to use it, most books i've seen...
1
3390
by: shaunwo | last post by:
I'm an AJAX / DOM Novice (at best) and trying to figure out how to write the value to a couple input fields. I don't remember exactly where I got the ajax.js file I'm using from (went to the website...
11
3009
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I have run into a situation that if a page/tab that uses the Ajax toolkit (using .net version 3.5) is closed before the Ajax enable controls complete loading, then IE locks up. Does it in both IE7...
0
7112
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7146
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7183
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6852
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7356
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5448
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4878
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
277
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.