Hi,
Firstly, fantastic project!!
I'm creating an offline app that loads a html file into the browser control. This is working fine:
cefWebBrowser1.Browser.GetMainFrame().LoadUrl("file:///" + Application.StartupPath.Replace('\\', '/') + "/HTML/index.html");
Index.html calls some javascript that makes an AJAX request to a service held on my localhost (will eventually be moved to live server):
$.ajax({
url: "http://localhost:49203/Service.svc/MyMethod",
data: "{ 'id': '" + id + "'}",
success: function(data, success, methodName) {
var oData = jQuery.parseJSON(data.d);
console.log(oData);
},
...
}
However, I get the following error when this request is made:
XMLHttpRequest cannot load http://localhost:49203/Service.svc/MyMethod. Origin file:// is not allowed by Access-Control-Allow-Origin.
How can I get my CefWebBrowser to allow this cross domain request between File and HTTP?
I have tried the following but its not making any difference.:
CefRuntime.AddCrossOriginWhitelistEntry("file://", "http", "localhost:49203", true);
Any help would be greatly appreciated.
Thanks and again great project.
Riain