dougong1031 2017-03-30 10:39
浏览 107

将php重定向到youtube app ios

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.
In PHP I used header to make the redirect. But it didn’t work. I also used youtube scheme.

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");

In javascript, I tried the same but with windows.location:

<script>
window.location = "http://www.youtube.com/v/E91WD7sr_hU"; 

</script>

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.

 <a id="link-youtube" target="_blank" href="https://www.youtube.com/watch?v=T0WepLbWyq0">
<script>   
  document.getElementById("link-youtube").click();  
  </script>

Can somebody help me, please?
Thanks!

  • 写回答

1条回答 默认 最新

  • dongxian3418 2017-03-30 10:45
    关注

    Try with

    <script>
    window.location = "youtube://E91WD7sr_hU";
    </script>
    

    Where E91WD7sr_hU is the video path of http://www.youtube.com/v/E91WD7sr_hU

    评论

报告相同问题?

悬赏问题

  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)