title: How to produce a deeplink action from a web redirection
body: <p>I have php file which looks for <code>userAgent</code> string to reply with the correct <code>Intent</code> to start my application.</p>
  
  <p>The php file is:</p>
  
  <pre><code>&lt;SCRIPT language=javascript&gt;
      function redirectOnUserAgent() {
  
          var params = {};
  
          if (location.search) {
              var parts = location.search.substring(1).split('?');
          }
  
          var mapping = {
              // scheme : market://details?id=&lt;package_name&gt;
              'android': 'intent://www.example.com/ag?' + parts + '#Intent;scheme=http;package=com.my.example;end',
  
              ...
          }
  
          var userAgent = navigator.userAgent.toLowerCase();
          for (var dev in mapping) {
              if (userAgent.search(dev) != -1) {
  
                  window.location = mapping[dev];
                  return;
              }
          }
  
          //else redirect to another page, or nothing
          window.location = 'http://my.example.com';
      }
  &lt;/SCRIPT&gt;
  
  
  &lt;!DOCTYPE html&gt;
      &lt;head&gt;
          &lt;meta charset="UTF-8"&gt;
          &lt;title&gt;Redirect to AG&lt;/title&gt;
  
      &lt;/head&gt;
      &lt;BODY onload="redirectOnUserAgent();"&gt;
      &lt;/BODY&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And this file is called from <code>my.example.com/redirect_to_ag?siteId=xx&amp;data=yy</code></p>
  
  <p>Up to now, I was reading this url from a QRCode reader and so the reader gives me the url, I click on open, and then it automatically interprets the <code>intent</code> to start the application.</p>
  
  <p>Now, I wanted to do the same from a NFC Tag and saw it doesn't work.
  But in fact, when I manually enter the url in the Android Chrome url field, nothing happen. 
  And I don't know how to see what happens in Android Chrome.
  When I connect Android Studio to the device, if I read the url from a QRCode reader I see the following messages:</p>
  
  <pre><code>02-10 13:06:46.959 32710-32710/? W/cr_Chrome: Bad URI 'intent://www.example.com/ag?siteId=xx&amp;data=yy#Intent;scheme=http;package=com.my.example;end'
  02-10 13:06:46.962 607-1138/? I/ActivityManager: START u0 {act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=http://www.example.com/... flg=0x10000000 pkg=com.my.example cmp=com.my.example/.MainActivity (has extras)} from uid 10035 on display 0
  02-10 13:06:47.004 607-4281/? I/ActivityManager: moveTaskToBack: TaskRecord{cb23831 #882 A=com.android.chrome U=0 sz=1}
  02-10 13:06:47.042 607-4505/? I/ActivityManager: Start proc 392:com.android.chrome:sandboxed_process1/u0i82 for service com.android.chrome/org.chromium.content.app.SandboxedProcessService1
  02-10 13:06:47.199 607-4505/? I/ActivityManager: Process com.android.chrome:sandboxed_process0 (pid 32747) has died
  02-10 13:06:47.199 607-4505/? W/ActivityManager: Scheduling restart of crashed service com.android.chrome/org.chromium.content.app.SandboxedProcessService0 in 1000ms
  02-10 13:06:47.226 607-617/? I/ActivityManager: Start proc 406:com.ndguide.ndguide/u0a258 for activity com.ndguide.ndguide/.MainActivity
  02-10 13:06:47.264 607-673/? D/ConnectivityService: releasing NetworkRequest NetworkRequest [ id=320, legacyType=-1, [ Capabilities: INTERNET&amp;NOT_RESTRICTED&amp;TRUSTED] ]
  </code></pre>
  
  <p>And then the application starts. Good!</p>
  
  <p><strong>BUT</strong> when I manually enter the url in the browser's address field, I can see:</p>
  
  <pre><code>02-10 13:11:43.635 5186-5186/? W/cr_Chrome: Bad URI 'intent://www.example.com/ag?siteId=xx&amp;data=yy#Intent;scheme=http;package=com.my.example;end'
  02-10 13:11:43.644 5186-5186/? I/chromium: [INFO:CONSOLE(0)] "The navigation on intent://www.example.com/ag?siteId=xx&amp;data=yy#Intent;scheme=http;package=com.my.example;end is blocked.", source: http://my.example.com/redirect_to_ag?siteId=xx&amp;data=yy (0)
  </code></pre>
  
  <p>And nothing more happens.  </p>
  
  <p>So could you tell me what prevents Chrome to correctly interpret the intent when it's given from the same url input manually??</p>
  
  <p><strong>EDIT</strong><br>
  I don't really know if it could help but when I use the QRCode Reader and use the Intent Intercept tool, when I click on <code>Open the url</code> in the reader, Intent Intercept give me the following infos</p>
  
  <pre><code>ACTION:
  android.intent.action.VIEW
  DATA:
  http://my.example.com/redirect_to_ag?siteId=xx&amp;data=yy
  MIME:
  null
  URI:
  intent://www.example.com/ag?siteId=xx&amp;data=yy#Intent;scheme=http;launchFlags=0x13080000;end
  FLAGS:
  FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
  FLAG_ACTIVITY_FORWARD_RESULT
  FLAG_ACTIVITY_PREVIOUS_IS_TOP
  FLAG_ACTIVITY_RECEIVER_FOREGROUND
  EXTRAS:
  none
  MATCHING ACTIVITIES:
  Chrome (com.android.chrome  - com.google.android.apps.chrome.Main)
  </code></pre>
  
  <p>Then, when I click on <code>SEND EDITED CONTENT</code> to Chrome, application starts.
  Well, from my side I don't really know how it could help me....</p>
  
  <p>Again, my problem is to understand why it doesn't happen anything when I manually enter the url in Chrome's address field.</p>