Yes, Joe is correct... As per the sample I posted a day or so ago, in
simplest terms, use the following Javascript to get the object:
if (window.XMLHttpRequest) { // Non-IE browsers
req = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
req = new ActiveXObject("Microsoft.XMLHTTP");
}
In any browser other than IE, XMLHttpRequest is implemented as a native
object, so the branching is required. No need to sniff browsers or
anything, this should do the trick across the board.
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
On Wed, March 30, 2005 9:34 am, Joe Germuska said:
>>This is working fine AFAIK, but while in IE it displays the result
>>and that is all, in Firefox the page is still in a loading
>>process... even though it has displayed all there was to be
>>displayed !
>>
>>I don't think this is a problem with Struts, rather with Firefox and
>>its way of handling XMLHttpRequest... But is there a way to bypass
>>this behaviour ?
>
> I don't think you can use ActiveXObjects in Firefox -- you certainly
> wouldn't be able to reach users of non-Windows systems.
>
> Here's a scrap I borrowed last time I was doing some experimenting
> with this approach:
>
> // Browser-independent way to get an XMLHttpRequest
> // borrowed from
> // http://www.peej.co.uk/articles/rich-user-experience.html
> function getHTTPObject() {
> var xmlhttp;
> /[EMAIL PROTECTED]
> @if (@_jscript_version >= 5)
> try {
> xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
> } catch (e) {
> try {
> xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
> } catch (E) {
> xmlhttp = false;
> }
> }
> @else xmlhttp = false;
> @end @*/
> if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
> try {
> xmlhttp = new XMLHttpRequest();
> } catch (e) {
> xmlhttp = false;
> }
> }
> return xmlhttp;
> }
>
>
> I haven't explored it much, but this XML.com article describes a
> Javascript library called "Sarissa" which is intended to (among many
> more things) smooth over this cross-browser difference in actually
> obtaining an XMLHttpRequest object.
>
> http://www.xml.com/pub/a/2005/02/23/sarissa.html
>
>
> Joe
>
> --
> Joe Germuska
> [EMAIL PROTECTED]
> http://blog.germuska.com
> "Narrow minds are weapons made for mass destruction" -The Ex
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]