title: WKWebView XMLHttpRequest Failed to load resource
body: <p>everyone!</p>
  
  <p>I have WKWebView which loads local XML with js inside.</p>
  
  <pre><code>function loadSegment(url,uuid) {
      let xhr = new XMLHttpRequest();
      xhr.onerror = () =&gt; rejected();
      xhr.onabort = () =&gt; rejected();
      xhr.ontimeout = () =&gt; rejected();
      xhr.onload = () =&gt; xhr.status === 200 ? handleSegment(url, uuid, xhr.response) : rejected();
      xhr.open("GET", url);
      xhr.responseType = "arraybuffer";
      xhr.send(null)
  }
  
  function handleSegment(url,uuid,res) {
  // url, uuid, res to json
  // webkit.messageHandlers.LoadHandler.postMessage(&lt;#JSON#&gt;)
  }
  
  function rejected() {
  
  }
  </code></pre>
  
  <p>After WebView has been successfully loaded file I evaluate </p>
  
  <pre><code>webView.evaluateJavaScript(script, completionHandler: { (response, error) in
  // Error handling
  }
  </code></pre>
  
  <p>Script evaluates successfully. But in Safari Inspector I see following error</p>
  
  <pre><code>[Error] Failed to load resource: The network connection was lost. (05.ts, line 0)
  [Error] Failed to load resource: A server with the specified hostname could not be found. (05.ts, line 0)
  </code></pre>
  
  <p>It tries to execute request the following url: <a href="http://edge.flowplayer.org/cilla_black_bean_sauce/1/216p-lo/00.ts" rel="nofollow noreferrer">http://edge.flowplayer.org/cilla_black_bean_sauce/1/216p-lo/00.ts</a></p>
  
  <p>The most strange thing is what it works perfectly on simulator.</p>
  
  <p>Have anyone faced similar problem?</p>