Opening a script from within an iframe
phreed <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <0b22769b-cd52-4aff-bc86-dfc55b7a078b@x35g2000hsb.googlegroups.com> |
I have a xul application with several files
y.xul
x.xml
z.js
'y.xul' contains the following fragment...
...
<groupbox id="widget_y" flex="1">
<caption label="Picture Widget"/>
<iframe src="y.xml" id="frame_y" flex="1"/>
</groupbox>
...
the file 'y.xml' is an svg file that contains the following
fragment...
...
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:html="http://www.w3.org/1999/xhtml"
onload="init(evt);">
<script type="text/javascript" src="context/z.js"/>
...
the file 'z.js' contains...
function jsdump(str)
{
Components.classes['@mozilla.org/consoleservice;1']
.getService(Components.interfaces.nsIConsoleService)
.logStringMessage(str);
}
The problem is that the script 'z.js' is not loaded.
Apparently the <script> element does not have the correct path for src
attribute?
If the line...
<script type="text/javascript" src="context/z.js"/>
...is replaced with...
<script type="text/javascript">
<![CDATA[
function jsdump(str)
{
Components.classes['@mozilla.org/consoleservice;1']
.getService(Components.interfaces.nsIConsoleService)
.logStringMessage(str);
}
// ]]>
</script>
...the jsdump function is properly defined.
The three files all live in the same 'myapp/chrome/context/'
directory.
I have tried the following variations but to no avail.
<script type="text/javascript" src="z.js"/>
<script type="text/javascript" src="context/z.js"/>
<script type="text/javascript" src="chrome://myapp/content/z.js"/>
<script type="text/javascript" src="file://full-path/content/z.js"/>