Welcome Guest Search | Active Topics | Sign In | Register

EO.WebBrowser CORS file:/// Error Options
David Robinson
Posted: Thursday, March 24, 2022 12:37:48 PM
Rank: Advanced Member
Groups: Member

Joined: 4/6/2015
Posts: 33
We are now getting a CORS error when trying to load a a file from disk.

Access to XMLHttpRequest at 'file:///C:/changed/for/security/BIN/DEBUG/ourfile.PDF' from origin 'http://bnimble.bnimble' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.

We are using EO.WebBrowser 21.2.70.0.

This worked with EO.WebBrowser 19.1.40.0.

We are setting EnableWebSecurity False.

' Disable Cross Origin loading for the WebView
' Note: Can also be disabled for the Engine as a whole or for the entire App
Dim options As New EO.WebEngine.BrowserOptions()
options.EnableWebSecurity = False
WebView1.SetOptions(options)

We have also tried:

WebView1.Engine.Options.ExtraCommandLineArgs = "--Access-Control-Allow-Origin"

Thanks,
David
eo_support
Posted: Thursday, March 24, 2022 6:20:26 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

Please try this:

Code: C#
EO.WebEngine.EngineOptions.Default.ExtraCommandLineArgs = "--disable-web-security";


This is a global setting that must be set before you use any WebView. So for example, if you use Windows.Forms, then you can set it in your Main method before you creating your main form. This should disable CORS entirely. They way you set it won't work because it is set after the WebView has been created. BrowserOptions.EnableWebSecurity won't work either because it is per WebView. CORS can only be turned off globally from command line.

Hope this helps. Please let us know if it works for you.

Thanks!
David Robinson
Posted: Saturday, March 26, 2022 8:03:44 PM
Rank: Advanced Member
Groups: Member

Joined: 4/6/2015
Posts: 33
We tried the following, as the first call to EO and after the License call. No success.
EO.WebEngine.EngineOptions.Default.ExtraCommandLineArgs = "--disable-web-security --Access-Control-Allow-Origin"
eo_support
Posted: Monday, March 28, 2022 1:43:43 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

In that case please try to isolate the problem into a test project and send the test project to us. See here for more details:

https://www.essentialobjects.com/forum/test_project.aspx

Once we have the test project, we will debug into the source code here and see what we can find.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.