Re: Opening a script from within an iframe

phreed <[email protected]>
Newsgroups gmane.comp.mozilla.devel.dom
Organization http://groups.google.com
Message-ID <[email protected]>
On May 21, 12:09 pm, phreed <[email protected]> wrote:
> 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['[email protected]/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['[email protected]/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"/>

It appears to be an 'svg' issue.
<script type="text/javascript" xlink:href="chrome://myapp/content/
z.js"/>
...works fine.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.