title: Launching Ionic app using web URL
body: <p>Here is my situation:</p>
  
  <ol>
  <li>User request an email of forgot password.  </li>
  <li>User use their Android/iPhone to open email and tap on the link inside the email  </li>
  <li>When the link is tapped (clicked), it'll call the Ionic app.</li>
  </ol>
  
  <p>I spend the whole morning to research and found this <a href="https://github.com/EddyVerbruggen/Custom-URL-scheme" rel="nofollow">solution</a>: using a plugin of Cordova named <code>Custom-URL-scheme</code>.<br>
  I also found out a tutorial from <a href="http://sysgears.com/notes/launch-ionic-app-with-a-web-or-email-link/" rel="nofollow">sysgears</a> that I need to add this code into my <code>app.js</code> file:</p>
  
  <pre><code>.run(['$state', '$window',
      function($state, $window) {
          $window.addEventListener('LaunchUrl', function(event) {
              // gets page name from url
              var page =/.*:[/]{2}([^?]*)[?]?(.*)/.exec(event.detail.url)[1];
              // redirects to page specified in url
              $state.go('tab.'+ page, {});
          });
      }
  ]);
  
  function handleOpenURL(url) {
      setTimeout( function() {
          var event = new CustomEvent('LaunchUrl', {detail: {'url': url}});
          window.dispatchEvent(event);
      }, 0);
  }
  </code></pre>
  
  <p>I've done everything, however it does not work. I tried to type my <code>URL_SCHEME</code> (<a href="http://myapp://" rel="nofollow">http://myapp://</a>) into the Chrome browser in Android phone but Chrome just display an error message:</p>
  
  <blockquote>
    <p>This webpage is not available. ERR_NAME_NOT_RESOLVED.  </p>
  </blockquote>
  
  <p>Please help me. Thanks.</p>