搜索 内容详情
手机网页弹窗提示下载app
lan988 级别:管理员  + 关注    收藏 支持(0) | 反对(0)原内容


<!--弹窗提示下载app-->
<style>
 /* 隐藏弹窗 */
.popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    z-index: 9999;
    /* 设置宽度和高度 */
    width: 50%;
    height: 70px;
}

/* 弹窗标题样式 */
.popup h3 {
    margin-top: 0;
    color: #333;
}

/* 提示文本样式 */
.popup p {
    margin-bottom: 10px;
    color: #666;
}

/* 下载链接样式 */
.popup a {
    display: inline-block;
    padding: 8px 16px;
    background-color: #007bff;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    margin-right: 10px;
}

/* 关闭按钮样式 */
.popup button {
    padding: 8px 16px;
    background-color: #ccc;
    color: #333;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
  </style>
 <script>
    function isInBrowser() {
      return typeof window!== 'undefined' && typeof document!== 'undefined';
    }

    function isHBuilderXWrapped() {
      const metaTags = document.getElementsByTagName('meta');
      for (let i = 0; i < metaTags.length; i++) {
        if (metaTags[i].getAttribute('name') === 'hbuilderx-wrapped' && metaTags[i].getAttribute('content') === 'true') {
          return true;
        }
      }
      return false;
    }

    function isMobileBuiltInBrowser() {
      const userAgent = navigator.userAgent;
      // 这里可以根据不同手机内置浏览器的特征进行判断
      return userAgent.includes('Android') && userAgent.includes('Browser') || userAgent.includes('Safari') && userAgent.includes('iPhone');
    }

    function showPopupIfNeeded() {
      if (isInBrowser() &&!isHBuilderXWrapped() && isMobileBuiltInBrowser()) {
        document.getElementById('popup').classList.add('show');
      }
    }
  </script>

  <div id="popup" class="popup">
    <p>为了获得更好的体验,建议下载我们玄门官网版本的 APP。</p>
    <a href="https://www.lan998.com/3g/display.asp?id=712" class="download-link">下载 APP</a>
    <button >关闭</button>
  </div>

  <script>
    function closePopup() {
      document.getElementById('popup').classList.remove('show');
    }

    window.onload = showPopupIfNeeded;
  </script>


回到顶部顶端 回到底部底部