开发者

Plugin closure and parsing params

I am writing a firebreath plugin that is supposed to display some object.

There are many cases of failure, since it is communicating with local software.

In case of a failure I want to close the plugin and to display a regular image instead. Or to get an image URL as a parameter, to parse the file and display it.

Both options are acceptable.

So-

  • What is the better option?
  • How do I totally close the plugin?
  • How do I parse parameters that are passed form the object tag?

I tried plugin->getParam("Name"), but didn't get the val开发者_如何学JAVAueI passed.

How do I do it?


Assuming your HTML looks something like this:

 <div id="plugincontainer">
    <object id="myplugin" type="application/x-myplugin" width="100" height="100">
    </object>
 </div>

You should be able to remove the plugin like this:

 document.GetElementById('plugincontainer').innerHTML = "";

Or if you're using jQuery:

 $("#plugincontainer").empty();

This will result in a call to onWindowDetached inside of Firebreath where you can unload your code.

You're then able to add new HTML into the DOM:

 $("#plugincontainer").append("<img src='images/my.jpg' />");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜