473,624 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

History exercise: Mac IE and XMLHttpRequest

I'm working on cross-platform portability of some javascript.
My Macintosh testing platform is rather old. It has Safari
1.3.2 and Internet Explorer 5.2. I got Safari working, but
now IE is causing trouble. It chokes on this:

if (window.XMLHttp Request)
nameReq = new XMLHttpRequest( );
else if (window.ActiveX Object)
nameReq = new ActiveXObject(" Microsoft.XMLHT TP");

The error message on the last line is "Object doesn't support
this action".

I can't pretend to understand much of this. I'm copying
patterns that I find in various places.

Is it possible that this browser is just too old to support
XMLHttpRequest? If so, does anyone know the earliest version
for which this would work?
Dec 29 '07 #1
6 2298
On Dec 28, 8:52*pm, Patrick Nolan <p...@glast2.St anford.EDUwrote :
I'm working on cross-platform portability of some javascript.
My Macintosh testing platform is rather old. *It has Safari
1.3.2 and Internet Explorer 5.2. *I got Safari working, but
now IE is causing trouble. *It chokes on this:

* if (window.XMLHttp Request)
* * * nameReq = new XMLHttpRequest( );
* else if (window.ActiveX Object)
* * * nameReq = new ActiveXObject(" Microsoft.XMLHT TP");

The error message on the last line is "Object doesn't support
this action".

I can't pretend to understand much of this. *I'm copying
patterns that I find in various places.

Is it possible that this browser is just too old to support
XMLHttpRequest? *If so, does anyone know the earliest version
for which this would work?
It is too old to have XMLHttpRequest and certainly won't create and
ActiveX object. However, should safely exclude it from using Ajax,
rather than throw an error. Try this:

else if (typeof window.ActiveXO bject == 'function' || (typeof
window.ActiveXO bject == 'object' && window.ActiveXO bject))

If that fails, do this:

alert(typeof window.ActiveXO bject);

(and post the result.)

I would be interested to know just what window.ActiveXO bject is in Mac
IE. It can't possibly be a useful constructor.
Dec 29 '07 #2
On 2007-12-29, David Mark <dm***********@ gmail.comwrote:
On Dec 28, 8:52*pm, Patrick Nolan <p...@glast2.St anford.EDUwrote :
>I'm working on cross-platform portability of some javascript.
My Macintosh testing platform is rather old. *It has Safari
1.3.2 and Internet Explorer 5.2. *I got Safari working, but
now IE is causing trouble. *It chokes on this:

* if (window.XMLHttp Request)
* * * nameReq = new XMLHttpRequest( );
* else if (window.ActiveX Object)
* * * nameReq = new ActiveXObject(" Microsoft.XMLHT TP");

The error message on the last line is "Object doesn't support
this action".

Is it possible that this browser is just too old to support
XMLHttpRequest ? *If so, does anyone know the earliest version
for which this would work?

It is too old to have XMLHttpRequest and certainly won't create and
ActiveX object. However, should safely exclude it from using Ajax,
rather than throw an error. Try this:

else if (typeof window.ActiveXO bject == 'function' || (typeof
window.ActiveXO bject == 'object' && window.ActiveXO bject))

If that fails, do this:

alert(typeof window.ActiveXO bject);

(and post the result.)
It says "undefined" . This looks hopeless.
>
I would be interested to know just what window.ActiveXO bject is in Mac
IE. It can't possibly be a useful constructor.
Dec 30 '07 #3
On Dec 29, 7:58*pm, Patrick Nolan <p...@glast2.St anford.EDUwrote :
On 2007-12-29, David Mark <dmark.cins...@ gmail.comwrote:


On Dec 28, 8:52*pm, Patrick Nolan <p...@glast2.St anford.EDUwrote :
I'm working on cross-platform portability of some javascript.
My Macintosh testing platform is rather old. *It has Safari
1.3.2 and Internet Explorer 5.2. *I got Safari working, but
now IE is causing trouble. *It chokes on this:
* if (window.XMLHttp Request)
* * * nameReq = new XMLHttpRequest( );
* else if (window.ActiveX Object)
* * * nameReq = new ActiveXObject(" Microsoft.XMLHT TP");
The error message on the last line is "Object doesn't support
this action".
Is it possible that this browser is just too old to support
XMLHttpRequest? *If so, does anyone know the earliest version
for which this would work?
It is too old to have XMLHttpRequest and certainly won't create and
ActiveX object. *However, should safely exclude it from using Ajax,
rather than throw an error. *Try this:
else if (typeof window.ActiveXO bject == 'function' || (typeof
window.ActiveXO bject == 'object' && window.ActiveXO bject))
If that fails, do this:
alert(typeof window.ActiveXO bject);
(and post the result.)

It says "undefined" . *This looks hopeless. *
Not really. Looking at your feature test:
if (window.XMLHttp Request)
nameReq = new XMLHttpRequest( );
else if (window.ActiveX Object)
nameReq = new ActiveXObject(" Microsoft.XMLHT TP");

The last line should not execute if window.ActiveXO bject is
undefined. Are you sure that is the line that errors?

I seem to remember having some weird problems like this with a very
old Mac AOL browser that was based on IE. Try this cleaned up version
as a test case:

if (typeof window.XMLHttpR equest != 'undefined') {
alert('Creating XMLHttpRequest' );
nameReq = new window.XMLHttpR equest();
}
else {
if (typeof window.ActiveXO bject != 'undefined') {
alert('Creating ActiveX');
nameReq = new window.ActiveXO bject("Microsof t.XMLHTTP");
}
}

You shouldn't get any alerts or errors. If you do get an error, it
should be apparent which line caused it.
Dec 30 '07 #4
On 2007-12-30, David Mark <dm***********@ gmail.comwrote:
On Dec 29, 7:58*pm, Patrick Nolan <p...@glast2.St anford.EDUwrote :
>On 2007-12-29, David Mark <dmark.cins...@ gmail.comwrote:


Not really. Looking at your feature test:
if (window.XMLHttp Request)
nameReq = new XMLHttpRequest( );
else if (window.ActiveX Object)
nameReq = new ActiveXObject(" Microsoft.XMLHT TP");

The last line should not execute if window.ActiveXO bject is
undefined. Are you sure that is the line that errors?

I seem to remember having some weird problems like this with a very
old Mac AOL browser that was based on IE. Try this cleaned up version
as a test case:

if (typeof window.XMLHttpR equest != 'undefined') {
alert('Creating XMLHttpRequest' );
nameReq = new window.XMLHttpR equest();
}
else {
if (typeof window.ActiveXO bject != 'undefined') {
alert('Creating ActiveX');
nameReq = new window.ActiveXO bject("Microsof t.XMLHTTP");
}
}
I get the alert "Creating ActiveX". Then it gets an error on the
next line: nameReq = new window.ActiveXO bject("Microsof t.XMLHTTP");
The error is "Object doesn't support this action".
This is the same place the error occurred before. (I'm depending on
the IE error popup and its source code display to show the correct
line number. So far I have no reason to doubt it.)

I'm beginning to believe that the ActiveXObject doesn't support the
Microsoft.XMLHT TP action in this antique browser. Maybe I should
not try to support this version. It's fairly unlikely that many
people will use it.
>
You shouldn't get any alerts or errors. If you do get an error, it
should be apparent which line caused it.
Dec 30 '07 #5
On Dec 29, 11:47*pm, Patrick Nolan <p...@glast2.St anford.EDUwrote :
On 2007-12-30, David Mark <dmark.cins...@ gmail.comwrote:


On Dec 29, 7:58*pm, Patrick Nolan <p...@glast2.St anford.EDUwrote :
On 2007-12-29, David Mark <dmark.cins...@ gmail.comwrote:
Not really. *Looking at your feature test:
*if (window.XMLHttp Request)
* *nameReq = new XMLHttpRequest( );
*else if (window.ActiveX Object)
* *nameReq = new ActiveXObject(" Microsoft.XMLHT TP");
The last line should not execute if window.ActiveXO bject is
undefined. *Are you sure that is the line that errors?
I seem to remember having some weird problems like this with a very
old Mac AOL browser that was based on IE. *Try this cleaned up version
as a test case:
*if (typeof window.XMLHttpR equest != 'undefined') {
* *alert('Creatin g XMLHttpRequest' );
* *nameReq = new window.XMLHttpR equest();
*}
*else {
* *if (typeof window.ActiveXO bject != 'undefined') {
* * *alert('Creatin g ActiveX');
* * *nameReq = new window.ActiveXO bject("Microsof t.XMLHTTP");
* *}
*}

I get the alert "Creating ActiveX". *Then it gets an error on the
next line: nameReq = new window.ActiveXO bject("Microsof t.XMLHTTP");
That doesn't make any sense. What does these show:

alert(typeof window.ActiveXO bject == 'undefined');

alert(typeof window.ActiveXO bject != 'undefined');
The error is "Object doesn't support this action".
It should never get there if window.ActiveXO bject is undefined.
This is the same place the error occurred before. *(I'm depending on
the IE error popup and its source code display to show the correct
line number. *So far I have no reason to doubt it.)

I'm beginning to believe that the ActiveXObject doesn't support the
Microsoft.XMLHT TP action in this antique browser. *Maybe I should
ActiveX doesn't do anything on a Mac. That is why
window.ActiveXO bject is undefined. It should be trivial to detect
that and skip the of creation the object.
not try to support this version. *It's fairly unlikely that many
people will use it.
Yes, it is basically a waste of time.
Dec 30 '07 #6
Patrick Nolan wrote:
I'm beginning to believe that the ActiveXObject doesn't support the
Microsoft.XMLHT TP action in this antique browser [IE 5.2 for Mac]. [...]
Have you read <news:47******* *******@Pointed Ears.defully? (Unlike you, I
quote properly, so where there is a quote block there is a response below it.)
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Dec 30 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1965
by: Rg | last post by:
Hello, I am very beginner with jscript. I have an Apache PHP enabled webserver and want to know from where users are coming from. Understand I want the last surfer's browser visited url. I imagine I can do this with some kind of interraction between 2 scripts : one client side, one server side. The client one send the URL and the server one write it in the right log file. I have no idea of how to do this ... Can somebody help? Any idea...
10
14079
by: Matt Kruse | last post by:
I'm aware of the circular reference memory leak problem with IE/closures. I'm not sure exactly how to resolve it in this situation. Also, Firefox appears to grow its memory size with the same code. So I'm wondering if I'm missing something? My test code is as follows: function myObj() { var req = new Object(); req.temp = 0;
21
11728
by: Joe Attardi | last post by:
Hey all! I was reading over at the IE Blog the other day http://http://blogs.msdn.com/ie/] and read some interesting, and encouraging news. According to Sunava Dutta, an IE Program Manager, starting in IE7 XMLHttpRequest will be a plain JavaScript object. It will still include the Microsoft.XMLHTTP ActiveX component for compatibility, but IMHO this is a very good shift for IE. What do you think?
5
6056
by: namemattersnot | last post by:
I have a SAJAX login authentication script that, if the the correct password is provided, returns "history.go(0)" to the page and I then use "eval()" on the returned data to refresh it. If the requested page has # in it (http://localhost/whatever/#), it refreshes in Internet Explorer but not in Firefox. Any ideas why? Is there a better way to refresh it? Thanks.
13
11480
by: TLaufenberg | last post by:
I'm new to Javascript programming and I've run into a bit of a snag with making an XMLHttpRequest in the Safari browser. Actually, the request doesn't work in Firefox either but only when I use a Mac computer. IE and FireFox on a Windows based system works just fine. The problem I am having is that the XMLHttpRequest doesn't open the site that I've programmed into it. When I check the readyState it only returns 0 and never goes through the...
5
2387
by: Peter Michaux | last post by:
Hi, The FAQ correctly says the following: "Mozilla (NN6.2+, Firefox, Ice Weasle etc), Opera 7.6+, Safari1.2+, the Windows version of IE versions 5+, and some other browsers provide the XML HTTP Request object." In my haze of testing yesterday it seems that NN6.1 provides an non-functional XMLHttpRequest object and NN6.2 XMLHttpRequest object
1
4023
by: geevaa | last post by:
http://www.phpbuilder.com/columns/kassemi20050606.php3 XMLHttpRequest and AJAX for PHP programmers James Kassemi Introduction: Although the concept isn't entirely new, XMLHttpRequest technology is implemented on more sites now than ever. Compatibility is no longer an issue (IE, Mozilla and Opera all support it), and the benefits to using it are amazing. There are too many PHP programmers avoiding any
1
5295
by: Tarik Monem | last post by:
OK, I'm pretty sure this cannot work because I'm trying to use JavaScript (client-side) to write to an xml file (which is server-side) using XMLHttpRequest. Can I use PHP do what I'm trying to do? Here's my code: The function mySaveFunction() is called by clicking the "Update" button, after the user changes the data which is populated in the form fields, which was retrieved via XMLHttpRequest from an XML external file. I know that...
0
8175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8680
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8482
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4082
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2610
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 we have to send another system
1
1791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1487
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.