2

I use a DotNetBrowser in my WPF application and I have a problem js

$(document).ready(function(){
  $.getJSON("data.json").success(function() {
      alert("succes");
  }).error(function(e) { 
      alert("error");
  });
});

error

Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

how fix??

Саске
  • 190
  • 3
  • 12

1 Answers1

0

You need to specify the --disable-web-security Chromium switch before creating any Browser or BrowserView instances:

BrowserPreferences.SetChromiumSwitches("--disable-web-security");

The following article provides more details about switches: https://dotnetbrowser.support.teamdev.com/support/solutions/articles/9000110017-chromium-switches

Anna Dolbina
  • 1
  • 1
  • 8
  • 9