title: CefSharp and Crossdomain
body: <p>I'm trying to use the <a href="https://github.com/cefsharp/CefSharp" rel="nofollow noreferrer">CefSharp web browser</a> inside a .NET 4.0 application.
  I load pages from html and js content stored locally. So the web browser opens the pages with the <code>file://</code> protocol.</p>
  <p>The page transitions are made with jQuery (ajax) and I get a <code>XMLHttpRequest cannot load file:///XXXXXXXX/Debug/res/www/shared/js/src/views/homeView.html. Cross origin requests are only supported for HTTP. </code></p>
  <p>I tried using a Schemehandler and override the <strong>ProcessRequest</strong> function to handle page loads inside the <code>file://</code> domain.</p>
  <pre><code>class SchemeHandlerFactory : ISchemeHandlerFactory
  {
      public ISchemeHandler Create()
      {
          return new SchemeHandler();
      }
  }
  
  class SchemeHandler : ISchemeHandler
  {
      public SchemeHandler()
      {
      }
  
      public bool ProcessRequest(IRequest request, ref string mimeType, ref Stream stream)
      {
          var uri = new Uri(request.Url);
          var segments = uri.Segments;
          var file = segments[segments.Length - 1];
  
          var bytes = File.ReadAllBytes(request.Url.Replace(&quot;file:///&quot;,&quot;&quot;));
              stream = new MemoryStream(bytes);
              mimeType = &quot;text/html&quot;;
  
              return true;
      }
  }
  </code></pre>
  <p>And I use it in my form code by adding :</p>
  <pre><code>CEF.RegisterScheme(&quot;file&quot;, new SchemeHandlerFactory());
  </code></pre>
  <p>it doesn't change anything.</p>
  <p>I checked the commit logs on the CefSharp repo and it says that the Cross AppDomain is now supported but how do I use it ? <a href="https://github.com/cefsharp/CefSharp/pull/35" rel="nofollow noreferrer">https://github.com/cefsharp/CefSharp/pull/35</a></p>
  <p>I also thought on recompiling CefSharp to add the  <strong>Access-Control-Allow-Origin</strong> to all the requests returned by the web browser when it executes <strong>GET</strong> operation on local files.</p>
  <p>I'm out of ideas.</p>