假设您的页面里面有一个javascript函数,现在我需要在plugin里面执行它:
-
- function ftest(){
- alert("exec javascript inside plugin ok...");
- }
plugin里面的调用这个ftest()函数的C++代码实现:
-
- NPString str;
- str.utf8characters = "ftest();";
- str.utf8length = strlen(str.utf8characters);
-
- NPVariant result1;
- NPObject* windowObject = NULL;
- //获取WindowObj
- NPError err = NPN_GetValue(mNpp, NPNVWindowNPObject, &windowObject);
- if (NPN_Evaluate(mNpp,windowObject, &str, &result1))
- {
- NPN_ReleaseVariantValue(&result1);
- }
- NPN_ReleaseObject(windowObject);
|
右边部分 |