title: iOS system hangs before opening App Store URL
body: <ol>
  <li><p>I have a HTML page with a Download app button. When clicked by an iOS user, it redirect the users to the App Store via itms-services. The link I used here is:</p>
  
  <pre><code>window.location.replace("itms-apps://itunes.apple.com/app/id578505616");
  </code></pre>
  
  <p>It looks like so on a mobile browser:
  <img src="https://i.stack.imgur.com/EqPjE.png" alt="Mobile webpage with Download button"></p></li>
  <li><p>Facebook/Pinterest has an in-app browser which asks for the user's consent before redirect the user out of their app in the form of an Alert box with  Cancel or Open app, which Open app opens the external link. It looks like this:
  <img src="https://i.stack.imgur.com/Ei4Fl.png" alt="Mobile webpage with Download button embedded in Facebook"></p></li>
  </ol>
  
  <p>It looks like this with the Alert box:
  <img src="https://i.stack.imgur.com/rRwST.png" alt="FB embedded browser with alert box"></p>
  
  <p>Assuming the user is using an iOS device. The expected behavior here is when the Open app button is clicked, the user gets redirected to the App Store app. However, we are seeing about a 10 seconds delay before the actual redirection happens. </p>
  
  <p>See videos below:</p>
  
  <p><a href="https://www.youtube.com/watch?v=_dgh7v-IsK8" rel="nofollow noreferrer">https://www.youtube.com/watch?v=_dgh7v-IsK8</a></p>
  
  <p><a href="https://www.youtube.com/watch?v=_LFHeRnBFgg" rel="nofollow noreferrer">https://www.youtube.com/watch?v=_LFHeRnBFgg</a></p>
  
  <p><a href="https://www.youtube.com/watch?v=82Y-kj-pMyw" rel="nofollow noreferrer">https://www.youtube.com/watch?v=82Y-kj-pMyw</a></p>
  
  <p>Notes:</p>
  
  <ol>
  <li>I can't seem to reproduce this at all times. It is only reproducible sometimes. Sorry!</li>
  <li>Once a device is delayed for the first time, all subsequent links to AppStores will be fast, until roughly 1 day late. Rebooting the phone and/or clearing the browser cache and/or reinstall Facebook/Pinterest does not help reproducing this.</li>
  <li>I tried to replace the itms-apps:// link with <a href="https://itunes.apple.com/us/app/trusper-tips-tutorials-how/id578505616?mt=8" rel="nofollow noreferrer">https://itunes.apple.com/us/app/trusper-tips-tutorials-how/id578505616?mt=8</a>, but we were still experiencing the delay from time to time.</li>
  <li>The delay seems to be exactly 10 seconds.</li>
  </ol>
  
  <p>Why does this delay occur? This seems like a bad user experience.</p>
  
  <p>My current theory is that the problem is on the Apple side. The reason being, once the Open app button is clicked, it is out of the hand of our website, as well as Facebook/Pinterest app. I presume, once the button is clicked, iOS is handling the actual context switch from one app to another. Therefore, it suggests that either the system call actually opening the URL is hanging, or the system call opening the App Store app is?? However, I haven't been able to prove either one to be true or false. Does anyone have a better explanation?</p>
  
  <p>[Edit 04/02/2015]
  I can confirm this problem still exists as of today on my phone (iPhone 5S w/ iOS 8.2).
  I did some further research and found this article which I think is suggesting that this is a iOS system-related bug: <a href="https://stackoverflow.com/questions/19356488/openurl-freezes-app-for-over-10-seconds">OpenUrl freezes app for over 10 seconds</a></p>