【问题标题】:How to stop web apps from opening in youtube?如何阻止网络应用在 youtube 中打开?
【发布时间】:2017-04-04 23:28:07
【问题描述】:

我正在为 iPad 制作一个移动网络应用程序。我从谷歌网站上获得了添加 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>

每当我打开网络应用程序时——甚至在应用程序加载之前且没有提示——它都会打开 YouTube 应用程序。谁能帮帮我?

我在http://mazes.ml/web-app 使用代码制作了一个新的网络应用程序:

<!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>

【问题讨论】:

    标签: html ipad web-applications youtube mobile-safari


    【解决方案1】:

    这实际上是基于 youtube 的代码。谷歌可以验证按钮实际上是被有意按下(而不是通过您网站上的脚本)的唯一方法是验证用户自己,并且在许多移动浏览器上,当用户被按下时,它会自动打开关联的应用程序从您的网站定向到 youtube。

    【讨论】:

    • 但如果我没有点击按钮,它会打开 youtube。它会在启动时打开 youtube 应用程序。
    • 你是将脚本标签放在页面的头部还是正文中?后者可能会给您带来麻烦。
    • 我把脚本放在了头部,它仍然在 youtube 中打开。
    猜你喜欢
    • 1970-01-01
    • 2023-04-11
    • 1970-01-01
    • 2023-04-06
    • 2018-09-19
    • 2021-03-10
    • 1970-01-01
    • 2019-01-16
    • 2015-07-02
    相关资源
    最近更新 更多