1)从 APP将 值传入到 html JS中
/*APP代码*/
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
var
TempValue : ICEFv8Value;
begin
TempValue := TCefv8ValueRef.NewString('将值从Delphi窗口传入到 JS变量 windows.myval!');
//绑定JS中 window.myval 的值
context.Global.SetValueByKey('mysetval', TempValue, V8_PROPERTY_ATTRIBUTE_NONE);
end;
/*JS代码*/
function myFunction() {
alert(window.mysetval);
}
2) APP注册一个函数myfunc ,JS调用该函数并传入入参,APP实现函数的方法。唤醒APP
//windows全部函数注册
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
var
TempHandler : ICefv8Handler;
TempFunction : ICefv8Value;
begin
TempHandler := TMyV8Handler.Creat