|
Rank: Advanced Member Groups: Member
Joined: 4/6/2015 Posts: 33
|
Is a Web Worker supposed to work in EO.WebBrowser?
I call new Worker(path) and it succeeds but even if the worker js file is empty, the Dev Tools window is blank and as best I can tell everything is hung. Alerts and console.log in the worker js file do not appear to execute.
Running EO.WebBrowser 19.1.40.0 Thanks David
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi, Web Worker has been supported by the Chromium browser engine since very early. We tested our latest build with this Web Worker sample and it works fine: https://github.com/mdn/simple-web-workerNote that you will need to put the files on a Web Server to test it. It won't run from local files. Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 4/6/2015 Posts: 33
|
Ouch. I need it to run from local files since everything else is... I even have cross-origin disabled with the BrowserOption EnableWebSecurity = False.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi, This is an restriction imposed by the Chromium engine but if you search online you should be able to find many workaround. The easiest workaround is to add "--allow-file-access-from-files" command line argument (with security implication of course). This would translate to the following code with EO.WebBrowser:
Code: C#
EO.WebEngine.EngineOptions.Default.ExtraCommandLineArgs = "--allow-file-access-from-files";
You can add this code to App.xaml.cs in the TabbedBrowser sample application before creating MainWindow and Web Worker should work from local files. Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 4/6/2015 Posts: 33
|
My app is in WinForms with a DevTools panel. I tried the ExtraCommandLineArgs above and it still hangs.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
Whether you use WinForms or WPF doesn't matter. The core features of EO.WebBrowser are platform neutral. I would recommend you to
1. Search online for this restriction on Google Chrome browser and you should be able to find a number of workaround for this; 2. Apply the workaround with TabbedBrowser sample application and get it work first; 3. Port the workaround from TabbedBrowser sample application to your application;
Also, can you PM us your order number?
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 4/6/2015 Posts: 33
|
We would appreciate it if you would confirm yourselves that you can add a Worker to any app of yours. All of our files from disk and they all work except for the web worker. And the web worker is clearly being found because if I give it a bad file name, a error shows up in the console.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
We are not in a position to provide support on generic issues that also exists in Google Chrome. So you will need to find the workaround and apply them yourself. The best we can do is to point you to the right direction --- I believe we have already done so in this case.
I am not sure what you meant by "if you would confirm that you can add a Worker to any app" ---- to us whatever app does not matter. Whatever the workaround is, if it works with TabbedBrowser sample application, it will work in your app.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 4/6/2015 Posts: 33
|
Hi, I apologise for pointing the finger at Web Worker. With a simple test, I have found that it works as you suggested. Thank you and sorry.
The real problem seems to be that I am trying to access eoapi in the web worker. Should that work?
I have an EO WebBrowser front end over a .NET application and it seems that the application can get busy doing internal processing and SQL access. If I can access eoapi in a web worker, then I think the .NET code would be running in a different thread from the UI. (Is that correct?)
Thank you for your patience, David
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
eoapi does not have anything to do with WebWorker. Global variable "eoapi" is in fact a member of your window object, which object does not exist in a WebWorker, so neither eoapi would exist in a WebWorker.
Thanks
|
|