You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-06-12 22:07:39 +02:00
bug fix #68
This commit is contained in:
@ -74,16 +74,36 @@ type
|
||||
var
|
||||
JSWindowBindingWithObjectFrm: TJSWindowBindingWithObjectFrm;
|
||||
|
||||
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
uses
|
||||
uCEFv8Value, uMyV8Accessor;
|
||||
|
||||
// The CEF3 document describing JavaScript integration is here :
|
||||
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
||||
|
||||
// The HTML file in this demo has a button that shows the contents of 'window.myobj.myval'
|
||||
// which was set in the GlobalCEFApp.OnContextCreated event.
|
||||
|
||||
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||
var
|
||||
TempAccessor : ICefV8Accessor;
|
||||
TempObject : ICefv8Value;
|
||||
begin
|
||||
// This is the first JS Window Binding example in the "JavaScript Integration" wiki page at
|
||||
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
||||
|
||||
TempAccessor := TMyV8Accessor.Create;
|
||||
TempObject := TCefv8ValueRef.NewObject(TempAccessor, nil);
|
||||
TempObject.SetValueByKey('myval', TCefv8ValueRef.NewString('My Value!'), V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
|
||||
context.Global.SetValueByKey('myobj', TempObject, V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithObjectFrm.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
Chromium1.LoadURL(Edit1.Text);
|
||||
|
Reference in New Issue
Block a user