Opened 13 years ago

Closed 13 years ago

#844 closed defect (invalid)

ActiveX

Reported by: anonymous Owned by: anonymous
Priority: high Milestone:
Component: IO Version: 0.3
Keywords: Cc:
Blocked By: Blocking:

Description

Can Dojo be made to work in IE if ActiveX is disabled?

Change History (7)

comment:1 Changed 13 years ago by James Burke

Resolution: wontfix
Status: newclosed

Can you provide more information? What part does not work if ActiveX is disabled? If you are referring to dojo.io.bind() that uses XMLHttpRequest, then for IE 6.0, no. IE 7 will provide a non-ActiveX XMLHttpRequest.

You can avoid using the ActiveX XMLHttpRequest dojo.io.bind() by using IframeIO: http://archive.dojotoolkit.org/nightly/tests/io/test_IframeIO.html

or ScriptSrcIO: http://archive.dojotoolkit.org/nightly/tests/io/test_ScriptSrcIO.html

Closing bug, but feel free to reopen and provide more information.

comment:2 Changed 13 years ago by anonymous

My client is on IE6 with ActiveX turned off. I'd be nice if dojo would attempt to use XMLHttpRequest if available, if not it should simulate XHR with a hidden IFrame.

comment:3 Changed 13 years ago by James Burke

Unfortunately, IframeIO is not a drop-in replacement for XHR. XHR can conceivably do other HTTP commands besides just a POST or GET, and IframeIO requires the response to be wrapped in an HTML page (so that we get load notification). So given that, we can't introduce generic logic in Dojo for that fallback behavior.

If you need a solution for your project, you could try invoking ActiveX and it fails, do the branching to IframeIO (and also provide different responses for that type of IO). You can use something like this to detect for XMLHttpRequest:

var hasXmlHttp = dojo.hostenv.getXmlhttpObject() ? true : false;

That is the line BrowserIO uses to make sure it can do XHR requests. Note that you should normally avoid calling dojo.hostenv.* methods, but if you need something quick, you can use it. Just note that it may change in the future (but I'm not aware of an imminent change).

comment:4 Changed 13 years ago by anonymous

Type: enhancementdefect

Is this excerpt from Pragmatic Ajax (p. 175) not correct then?

"Dojo will automatically detect whether a given browser supports XMLHttpRequest or the Microsoft equivalents and replace their use with hidden <iframe> tags if not."

comment:5 Changed 13 years ago by James Burke

If you do:

dojo.require("dojo.io"); dojo.require.("dojo.io.BrowserIO"); dojo.require("dojo.io.IframeIO");

and then do a dojo.io.bind(): *if* XMLHttpRequest cannot be used, and *if* you are binding to a form element, and *if* you don't want an XML response, then dojo.io.IframeIO might be chosen as the transport instead of BrowserIO (which uses XMLHttpRequest). However, the server will have to know how to format the response for each type of IO: namely IframeIO cannot do XML responses, and for the plain text or javascript responses, they have to be wrapped in an HTML document. For BrowserIO, you can just send raw javascript or text.

So I think in practice, it is not really a solution since most servers code assumes being able to do raw XML/JS or plain text, and not have to wrap it in the HTML wrapper for IframeIO.

But yes, if you are aware of all of these limitations and put in special handling to allow for both types of requests and responses, the fallback should work.

comment:6 Changed 13 years ago by guest

Component: GeneralIO
Resolution: wontfix
Status: closedreopened

As of 9/12/06, 11:30 PM CDT there is a failure using the iFrameIO transport if activeX is disabled in IE6 (v.6.0.2900.2180, SP2). I had posted an entry about it on the dojo interest mailing list, but have not received any useful responses. The one response I got said that by explicitly specifying the iFrameIO transport, it would work. It does not. Please go to the nightly test URL http://archive.dojotoolkit.org/nightly/tests/io/test_IframeIO.html.html and try it yourself.

Here is the content of my original post. It contains the output and the errors I am seeing.

> I was trying to use the test URL to demo the IFrame I/O transport
> (http://archive.dojotoolkit.org/nightly/tests/io/test_IframeIO.html.html)
> using IE with ActiveX disabled.  When going to the URL, I see the
> following errors:
>
> FATAL: XMLHTTP not available: Automation server can't create object
> DEBUG:  failed loading  ../../src/io/__package__.js  with error:
> [Error: XMLHTTP not available: Automation server can't create object]
> FATAL: XMLHTTP not available: Automation server can't create object
> DEBUG:  failed loading  ../../src/__package__.js  with error:  [Error:
> XMLHTTP not available: Automation server can't create object]
> FATAL: XMLHTTP not available: Automation server can't create object
> DEBUG:  failed loading  ../../__package__.js  with error:  [Error:
> XMLHTTP not available: Automation server can't create object]
> FATAL: symbol 'dojo.io' is not defined after loading '__package__.js'
>
>
> And if I try to submit the page via the 'send it!' button, I get a
> javascript error:
>
> Line: 184
> Char: 2
> Error: symbol 'dojo.io' is not defined after loading '__package__.js'
> Code: 0
> URL: http://archive.dojotoolkit.org/nightly/tests/io/test_IframeIO.html.html
>

comment:7 Changed 13 years ago by James Burke

Resolution: invalid
Status: reopenedclosed

Ah, so those errors are expected for a non-custom build of Dojo. When you don't use a custom build, Dojo uses XHR to load all the packages. So this will fail. You should do a custom build that includes all the packages you want to avoid the issue. I'll respond to the email thread (I still have it marked as new because I've been meaning to get back to it).

Note: See TracTickets for help on using tickets.