Opened 12 years ago

Closed 12 years ago

#3598 closed defect (duplicate)

'Normal' loading of external js with dojo.require fails in IE

Reported by: guest Owned by: James Burke
Priority: high Milestone: 0.9
Component: Core Version: 0.4.2
Keywords: Cc: welldamn@…
Blocked By: Blocking:

Description

In a custom widget, if I attempt to load some third-party js file to call some functions, I get "Object Expected" in IE.

I'm calling dojo.require("path.to.file", false, true) to load the js file, which I read in the dojo archives that using this syntax,

you can do without the "dojo.provide" call in your JS files by altering your dojo.require call.

e.g. dojo.require("my.path.to.file", false, true);

The last argument tells dojo not to validate that the object my.path.to.file exists, therefore you can put whatever you like in that file.

If i manually include the js script using a script tag, everything works fine in IE and firefox, so it's not a syntax error.

Simple test: create a custom widget, try to require (using the syntax above) an external js file which contains a simple function:

function test() { alert("test called"); }

and try to invoke that function from your custom widget.

Change History (2)

comment:1 Changed 12 years ago by bill

Owner: changed from anonymous to James Burke

comment:2 Changed 12 years ago by James Burke

Resolution: duplicate
Status: newclosed

The function test() will fail even with normal dojo.require/provide loading because of bug #744. If you do

window.test = function() { alert("test called");}

That should work. The problem is the scope used by IE's eval. As outlined in #744, there is no good fix for the problem, except the workaround stated above. Closing this bug out as a dupe of #744.

Note: See TracTickets for help on using tickets.