title: Is there an Ajax-like javascript technique to send requests with custom scheme urls?
body: <p>Is there any javascript framework/technique that allows to send asynchronous requests with custom scheme urls? Trying this with Ajax:</p>
  
  <pre><code>$.ajax({url: "myapp://root", success: function(result){
       console.log(result);
  }});
  </code></pre>
  
  <p>expectedly gets me the below error</p>
  
  <pre><code>XMLHttpRequest cannot load myapp://root. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
  </code></pre>
  
  <p>I'm trying to figure a way to check whether a deep link sent to my iOS app has been successfully received before I redirect to its iTunes page. My current javascript waits for a timeout before redirecting to iTunes, and that's not working as intended; a dialog pops up to ask whether the user wants to open the app, and if the timeout expires before they make their decision, they still get redirected to iTunes even if the dialog hasn't been answered/dismissed yet.</p>
  
  <p>Here's my javascript:</p>
  
  <pre><code>window.location = "myapp://somepath";
  setTimeout(function() {
      window.location = "https://itunesurl";
  }, 500);
  </code></pre>
  
  <p>Obviously increasing the timeout is not the solution I'm looking for.</p>