Unable to access local files about:blank#blocked
Posted: Sat May 11, 2019 5:50 pm
Hi,
I try to load a local javascript file and I receive "about:blank#blocked" error
2 Simple steps to reproduce using SimpleFMXBrowser
---------
1. in SimpleFMXBrowser app add
CreateGlobalCEFApp;
GlobalCEFApp.AllowFileAccessFromFiles:=true; // added and make no difference
GlobalCEFApp.DisableWebSecurity:=true; // added and make no difference
if GlobalCEFApp.StartMainProcess then
begin
Application.Initialize;
Application.CreateForm(TSimpleFMXBrowserFrm, SimpleFMXBrowserFrm);
Application.Run;
SimpleFMXBrowserFrm.Free;
end;
DestroyGlobalCEFApp;
---------
2. in uSimpleFMXBrowser unit
procedure TSimpleFMXBrowserFrm.GoBtnClick(Sender: TObject);
begin
FMXChromium1.LoadString('<!DOCTYPE html><html><head><script src="demo.js" onerror="alert(''demo faild'')"></script></head><body></body></html>',''); // added
// LoadURL; // commented
end;
where demo.js is an empty or not javascript file placed in the same directory with app, and chromium dll files (bin in this case)
Now run the app and click Go. At running time you will receive a javascript popup with title : "Javascript Alert - about:blank#blocked" and text "demo faild"
What settings I must use to allow the content ?
GlobalCEFApp.AllowFileAccessFromFiles:=true;
GlobalCEFApp.DisableWebSecurity:=true;
make no difference in this case
Thanks,
Pavel
I try to load a local javascript file and I receive "about:blank#blocked" error
2 Simple steps to reproduce using SimpleFMXBrowser
---------
1. in SimpleFMXBrowser app add
CreateGlobalCEFApp;
GlobalCEFApp.AllowFileAccessFromFiles:=true; // added and make no difference
GlobalCEFApp.DisableWebSecurity:=true; // added and make no difference
if GlobalCEFApp.StartMainProcess then
begin
Application.Initialize;
Application.CreateForm(TSimpleFMXBrowserFrm, SimpleFMXBrowserFrm);
Application.Run;
SimpleFMXBrowserFrm.Free;
end;
DestroyGlobalCEFApp;
---------
2. in uSimpleFMXBrowser unit
procedure TSimpleFMXBrowserFrm.GoBtnClick(Sender: TObject);
begin
FMXChromium1.LoadString('<!DOCTYPE html><html><head><script src="demo.js" onerror="alert(''demo faild'')"></script></head><body></body></html>',''); // added
// LoadURL; // commented
end;
where demo.js is an empty or not javascript file placed in the same directory with app, and chromium dll files (bin in this case)
Now run the app and click Go. At running time you will receive a javascript popup with title : "Javascript Alert - about:blank#blocked" and text "demo faild"
What settings I must use to allow the content ?
GlobalCEFApp.AllowFileAccessFromFiles:=true;
GlobalCEFApp.DisableWebSecurity:=true;
make no difference in this case
Thanks,
Pavel