title: Preventing browser loop
body: <p>I've created an app that opens when clicking a specific URL. Obviously I've got something like this:</p>
  
  <pre><code>        &lt;intent-filter&gt;
          &lt;data android:scheme="http" android:host="example.com"/&gt;
          &lt;action android:name="android.intent.action.VIEW"/&gt;
          &lt;category android:name="android.intent.category.BROWSABLE"/&gt;
          &lt;category android:name="android.intent.category.DEFAULT" /&gt;
          &lt;/intent-filter&gt;
  </code></pre>
  
  <p>So that's all great, whenever somebody clicks a link with <a href="http://example.com/whatever/stuff" rel="nofollow">http://example.com/whatever/stuff</a>... it'll open my app. However, within my app, after doing some stuff, I want to send the suer back to the default browser (or whichever browser/web view they were using when they clicked the link to begin with). My problem is that I end up creating a loop:</p>
  
  <ol>
  <li>User clicks link <a href="http://example.com/xxx" rel="nofollow">http://example.com/xxx</a> and my app opens.</li>
  <li>My app does stuff, and now wants to send the user to a different URL, eg. <a href="http://example.com/yyy" rel="nofollow">http://example.com/yyy</a></li>
  <li><p>The intent that my app sends, ends up just going back to itself (my app).</p>
  
  <pre><code>Intent httpIntent = new Intent(Intent.ACTION_VIEW);
  String theNewURL = http://example.com/yyy;
  httpIntent.setData(Uri.parse(theNewURL));
  startActivity(httpIntent);
  </code></pre></li>
  </ol>
  
  <p>How can I get my <code>httpIntent</code> to use the default browser (or wherever the user came from to begin with) instead of calling my app again?</p>
  
  <p>Edit: I've been able to solve the problem in a make-shift way, by making a CNAME record of one of my own domains (as a sort of alias) that goes to the same spot as <a href="http://example.com" rel="nofollow">http://example.com</a>. It sucks because the user now sees a different URL, but it still works in that it doesn't invoke the intent. (Am I even using the right language when I talk about intents?)</p>