title: Redirect php to youtube app ios
body: <p>I need to directly link a URL to a youtube video. The idea is if you put the link in a mobile, I must be opened in youtube APP. I didn’t start to try it in an Andriod phone until now. In iOS, I’m not able to open directly in the APP.
  I tried it in PHP and in Javascript.<br>
  In PHP I used header to make the redirect. But it didn’t work. I also used youtube scheme.</p>
  
  <pre><code>header("Location: http://www.youtube.com/v/T0WepLbWyq0");
  header("Location: https://www.youtube.com/watch?v=T0WepLbWyq0");
  header("Location: youtube://www.youtube.com/v/ T0WepLbWyq0");
  </code></pre>
  
  <p>In javascript, I tried the same but with windows.location:  </p>
  
  <pre><code>&lt;script&gt;
  window.location = "http://www.youtube.com/v/E91WD7sr_hU"; 
  
  &lt;/script&gt;
  </code></pre>
  
  <p>I discovered that if I put a “usual” link () it opens the APP as I want. Then I thought that maybe generating a click in javascript I will solve my issue. But It doesn’t work neither.    </p>
  
  <pre><code> &lt;a id="link-youtube" target="_blank" href="https://www.youtube.com/watch?v=T0WepLbWyq0"&gt;
  &lt;script&gt;   
    document.getElementById("link-youtube").click();  
    &lt;/script&gt;
  </code></pre>
  
  <p>Can somebody help me, please?<br>
  Thanks!</p>