Xcode Phonegap-0.94,苹果iPhone操作系统4.2.1:Youtube链接未启动Youtube应用程序
我使用phonegap创建了一个基本项目。并将这段html代码添加到我的index.hmtl中 点击youtube链接在Phonegap中启动youtube移动站点(一旦启动,就无法返回到我的Phonegap视图) 如何启用HREF链接以在iPhone/iPad上打开本机youtube应用程序? href链接符合Youtube链接的Apple规范,如中所示 My Index.html:Xcode Phonegap-0.94,苹果iPhone操作系统4.2.1:Youtube链接未启动Youtube应用程序,xcode,cordova,Xcode,Cordova,我使用phonegap创建了一个基本项目。并将这段html代码添加到我的index.hmtl中 点击youtube链接在Phonegap中启动youtube移动站点(一旦启动,就无法返回到我的Phonegap视图) 如何启用HREF链接以在iPhone/iPad上打开本机youtube应用程序? href链接符合Youtube链接的Apple规范,如中所示 My Index.html: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "
<!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>
MyTube
//如果要防止拖动,请取消对该部分的注释
/*
功能行为(e)
{
e、 预防默认值();
};
文档。addEventListener(“touchmove”,preventBehavior,false);
*/
函数onBodyLoad()
{
文件。添加的监听器(“deviceready”,OnDeviceraddy,false);
}
/*调用此函数时,PhoneGap已初始化,并且
准备就绪*/
函数ondevicerady()
{
//做你的事!
}
我的你管链接
我试了一下,得到了同样的结果。这很奇怪,因为我还假设YT的链接会触发原生YouTube应用程序。我发现的一件事是,嵌入将完成您所追求的,但没有遇到任何其他方式
<object width="300" height="199">
<param name="movie" value="http://www.youtube.com/v/NkTrG-gpIzE?fs=1&hl=en_US&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&hl=en_US&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="300" height="199"></embed>
</object>
我唯一的另一个建议是让你在PhoneGap谷歌群上发帖,但我看到你几分钟前刚刚这么做了。如果我还发现了什么,我会尝试分享它,但嵌入方法是迄今为止唯一有效的方法