I need to conditionally run a big (several pages) javascript file in the
browser. The kickoff event for this is a button click in an OL 3.4.0.
application which executes the conditional logic in Javascript and then
attempts to get the browser to load and run the big Javascript file.
Something like this:
<method name="toggle" event="onclick">
<![CDATA[
if (this.runBig=="true")
{
LzBrowser.loadJS('big.js'); // reports big.js is undefined
// or
LzBrowser.loadJS("src='big.js'"); // reports nothing however
big.js does not run.
// or
LzBrowser.loadURL('big.js'); // causes browser to pop a
dialog asking if I want to open the file.
}
]]>
</method>
The last case above: LzBrowser.loadURL('big.js'); indicates that OL can find
the file (it is in the same path as my main lzx application). Is there some
format of the file that I need to cause cause the browser to execute big.js
rather than prompting me to open it?
Right now the file is a simple ascii file with the following content:
javascript: alert('creating object');
var myObject = document.createElement('object');
alert(myObject);
myObject.id='123abc';
alert('idafter=' + myObject.id);
--
View this message in context:
http://www.nabble.com/loadJS-and-loadURL-for-external-javascript-file-tf3828615.html#a10838048
Sent from the OpenLaszlo - Dev mailing list archive at Nabble.com.