【问题标题】:Phonegap-0.94, Apple iPhone OS 4.2.1 : Youtube links not launching Youtube appPhonegap-0.94,Apple iPhone OS 4.2.1:Youtube 链接未启动 Youtube 应用程序
【发布时间】:2011-04-14 19:20:52
【问题描述】:

我使用 phonegap 创建了一个基本项目。并将这段 html 代码添加到我的 index.hmtl 单击 youtube 链接在 Phonegap 中启动 Youtube 移动网站(一旦启动,就无法返回到我的 phonegap 视图)

如何启用 HREF 链接以在 iPhone/iPad 上打开原生 youtube 应用程序? href 链接符合 Apple 的 Youtube 链接规范,如 https://developer.apple.com/library/safari/#featuredarticles/iPhoneURLScheme_Reference/Articles/YouTubeLinks.html

我的索引.html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/ 
TR/html4/strict.dtd"> 
<html> 
  <head> 
        <!-- Change this if you want to allow scaling --> 
    <meta name="viewport" content="width=default-width; user- 
scalable=no" /> 
    <meta http-equiv="Content-type" content="text/html; 
charset=utf-8"> 
    <title>MyTube</title> 
        <!-- iPad/iPhone specific css below, add after your main css > 
        <link rel="stylesheet" media="only screen and (max-device-width: 
1024px)" href="ipad.css" type="text/css" /> 
        <link rel="stylesheet" media="only screen and (max-device-width: 
480px)" href="iphone.css" type="text/css" /> 
        --> 
        <!-- If you application is targeting iOS BEFORE 4.0 you MUST put 
json2.js from http://www.JSON.org/json2.js into your www directory and 
include it here --> 
        <script type="text/javascript" charset="utf-8" src="phonegap. 
0.9.4.min.js"></script> 
    <script type="text/javascript" charset="utf-8"> 
        // If you want to prevent dragging, uncomment this section 
        /* 
        function preventBehavior(e) 
        { 
      e.preventDefault(); 
    }; 
        document.addEventListener("touchmove", preventBehavior, false); 
        */ 
        function onBodyLoad() 
        { 
                document.addEventListener("deviceready",onDeviceReady,false); 
        } 
        /* When this function is called, PhoneGap has been initialized and is 
ready to roll */ 
        function onDeviceReady() 
        { 
                // do your thing! 
        } 
    </script> 
  </head> 
  <body onload="onBodyLoad()"> 
        <h1> My You tube Links </h1> 
        <a href="http://www.youtube.com/v/NkTrG-gpIzE"> SOURCE-CODE 
Trailer </a> 
  </body> 
</html> 

【问题讨论】:

    标签: xcode cordova


    【解决方案1】:

    我尝试并得到了相同的结果。这很奇怪,因为我还假设指向 YT 的链接会触发原生 YouTube 应用。我发现的一件事是嵌入会做你所追求的,但没有遇到任何其他方式。

    <object width="300" height="199">
        <param name="movie" value="http://www.youtube.com/v/NkTrG-gpIzE?fs=1&amp;hl=en_US&amp;rel=0"></param>
        <param name="allowFullScreen" value="true"></param>
        <param name="allowscriptaccess" value="always"></param>
        <embed src="http://www.youtube.com/v/NkTrG-gpIzE?fs=1&amp;hl=en_US&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="300" height="199"></embed>
    </object>
    

    我唯一的其他建议是让您在 PhoneGap Google 群组上发帖,但我看到您在几分钟前刚刚这样做了。如果我发现任何其他内容,我会尝试分享,但嵌入方法是迄今为止唯一有效的方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-06
      • 1970-01-01
      • 2011-12-21
      • 2011-11-26
      • 1970-01-01
      • 2021-03-10
      • 2011-07-23
      • 1970-01-01
      相关资源
      最近更新 更多