如何阻止网络应用在YouTube上打开?

问题描述:

我正在为iPad制作移动网络应用程序。我得到了代码从谷歌网站上添加YouTube订阅按钮:如何阻止网络应用在YouTube上打开?

<script src="https://apis.google.com/js/platform.js"></script> 
<div class="g-ytsubscribe" data-channelid="UCICWAtoGya9rQRPRSseDpjw" data-layout="full" data-count="default"></div> 

每当我打开Web应用程序 - 应用程序甚至加载之前,没有一个提示 - 它打开YouTube应用。任何人都可以帮助我吗?

我在http://mazes.ml/web-app提出了一个新的Web应用程序的代码:

<!DOCTYPE html> 
 
<html> 
 
<head> 
 
<title>YouTube Button</title> 
 
<script src="https://apis.google.com/js/platform.js"></script> 
 
<meta name="apple-mobile-web-app-capable" content="yes"> 
 
<meta name="apple-mobile-web-app-title" content="YouTube Button"> 
 
</head> 
 

 
<body> 
 
<div class="g-ytsubscribe" data-channelid="UCICWAtoGya9rQRPRSseDpjw" data-layout="full" data-count="default"></div> 
 
</body> 
 
</html>

这是基于YouTube的代码,其实。 Google可以验证该按钮是否被有意按下(而不是通过您网站上的脚本)的唯一方法是通过自己对用户进行身份验证,并且在许多移动浏览器上,它会在用户处于关闭状态时自动打开关联的应用从您的网站直接转到youtube。

+0

但它会打开youtube,如果我没有点击按钮。它会在启动时打开youtube应用程序。 –

+0

您是将脚本标签放在页面的头部还是放在身体内部?后者可能会为你搞砸。 –

+0

我把脚本放在头上,它仍然在YouTube上打开。 –