2

I am trying to call firebreath functions from my javascript file.Everything works fine if I call the firebreath functions using an html document with javascript functions and also for firefox version upto 28. For higher versions of firefox on calling the functions through plugin I get an error "TypeError:plugin.echo is not a function" (echo is an inbuilt firebreath function). Find the below code for reference.

overlay.xul

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/"?>
<overlay id="mypluginOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
<script type="application/x-javascript" src="chrome://myplugin/content/ngContent.js"/>
    <vbox style="height:0;">
        <html:object type="application/x-myplugin" id="myplugin" style="height:0;"></html:object>
    </vbox>
</overlay>

ngContent.js

try
{
   var plugin = document.getElementById('myplugin');
   alert(plugin); // Output for firefox version upto 28 : <JSAPI-Auto Javascript Object>
                  //Output for firefox higher versions : [object HTMLObjectElement]
   plugin.echo("qwerty");
}
catch(ErrorMessage)
{
   alert(ErrorMessage);
}

Can anyone help me in this??? Thanks in advance....


EDIT: Tried html:embed tag instead of html:object in overlay.xul.

<?xml version="1.0"?>
    <?xml-stylesheet href="chrome://global/skin/"?>
    <overlay id="mypluginOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
    <script type="application/x-javascript" src="chrome://myplugin/content/ngContent.js"/>
        <vbox style="height:0;">
            <html:embed type="application/x-myplugin" id="myplugin" style="height:0;"></html:embed>
        </vbox>
    </overlay>

It doesn't work either.

0 Answers0