【问题标题】:Adding an android smart app banner icon using Javascript使用 Javascript 添加一个 android 智能应用程序横幅图标
【发布时间】:2019-05-03 21:49:10
【问题描述】:

我使用以下脚本在我的网站上显示应用智能横幅。一切都很好,但图标没有出现在 chrome (Android) 中。

我尝试添加不同大小的图标的url,但问题仍然存在。

<html>
  <head>
    <title>MyPage</title>

    <meta name="apple-itunes-app" content="app-id=502838820">
    <meta name="google-play-app" content="app-id=ru.hh.android">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" href="css/smart-app-banner.css" type="text/css" media="screen">
    <link rel="apple-touch-icon" href="apple-touch-icon.png">
    <link rel="android-touch-icon" href="android-icon.png" />
  </head>
  <body>
    ...
    <script src="js/smart-app-banner.js"></script>
    <script type="text/javascript">
      new SmartBanner({
          daysHidden: 15,   // days to hide banner after close button is clicked (defaults to 15)
          daysReminder: 90, // days to hide banner after "VIEW" button is clicked (defaults to 90)
          appStoreLanguage: 'us', // language code for the App Store (defaults to user's browser language)
          title: 'MyPage',
          author: 'MyCompany LLC',
          button: 'VIEW',
          store: {
              ios: 'On the App Store',
              android: 'In Google Play',
              windows: 'In Windows store'
          },
          price: {
              ios: 'FREE',
              android: 'FREE',
              windows: 'FREE'
          }
, icon: 'img/icon.png'


          // , theme: '' // put platform type ('ios', 'android', etc.) here to force single theme on all device
          // , icon: '' // full path to icon image if not using website icon image
          // , force: 'ios' // Uncomment for platform emulation
      });
    </script>
  </body>
</html>


【问题讨论】:

    标签: javascript html css


    【解决方案1】:

    老实说,只需使用 &lt;img&gt; 标签而不是 &lt;link&gt; 并将 href 设置为图像数据。您可以将您的 Javascript 转换为一个类并在您新制作的 &lt;img&gt; 标记中调用它,并且我相信基本上具有相同的结果。

    看看这些: Changing the image source using jQuery

    Get <img> src and set as variable via class (id not available)

    【讨论】:

      猜你喜欢
      • 2013-11-11
      • 2015-09-26
      • 2012-10-21
      • 1970-01-01
      • 2017-09-29
      • 2013-06-22
      • 1970-01-01
      • 2019-04-09
      • 1970-01-01
      相关资源
      最近更新 更多