问题
I have implemented a javascript function in firebreath plugin file 'MyPluginProject.cpp'
like
void MyPluginProjectAPI::MyJsThings()
{
std::string argument = "my javascript functionality goes here";
m_host->evaluateJavaScript(argument);
}
Now to use the MyJsThings in my webpages I have created <object> for the plugin. Now I can call MyJsThings by calling it in my javascript code like below
plugin.MyJsThings()
This is the very basic thing. Now I don't want to call MyJsThings method in my javascript. I am just creating object for the plugin by below code.
<object type="application/x-my-plugin-project" id="plugin" style="width:0px;height:0px;"> <param id="onload" value="alert('Plugin Loaded');"> </object>
When I load my page I want my method MyJsFunction has to be called so that my js functionalities will do the remaining things.
My main aim is to call the function MyJsFunction when the plugin is loaded, not in any where in the html script.
回答1:
Sounds like what you really want is to use the onPluginLoad method in your PluginCore-derived object.
Note that you would have found this if you'd read the getting started pages on the website and/or looked through the FBTestPlugin example -- highly recommended reading.
来源:https://stackoverflow.com/questions/24504743/how-to-start-the-javascript-function-in-my-firebreath-plugin