zoukankan      html  css  js  c++  java
  • 在微信下载app引导页代码

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    </head>
    
    <body>
    <script>
                    var downurl= 'http://27.195.157.198:8000/jiayouzhan/Public/app.apk';//需要下载的app路径
                    
                    function is_weixin() {
                        var ua = navigator.userAgent.toLowerCase();
                        if (ua.match(/MicroMessenger/i) == "micromessenger") {
                            return true;
                        }
                    }
    
                    var isWeixin = is_weixin();
                    var winHeight = typeof window.innerHeight != 'undefined' ? window.innerHeight : document.documentElement.clientHeight;
                    function loadHtml(){
                        var div = document.createElement('div');
                        div.id = 'weixin-tip';
                        div.innerHTML = "<p><img id="wx-img" src="img/lx1.jpg" alt="微信打开"/></p>";//图片提示用右上角在浏览器打开
                        document.body.appendChild(div);
                    }
    
                    function loadStyleText(cssText) {
                        var style = document.createElement('style');
                        style.rel = 'stylesheet';
                        style.type = 'text/css';
                        try {
                            style.appendChild(document.createTextNode(cssText));
                        } catch (e) {
                            style.styleSheet.cssText = cssText; //ie9以下
                        }
                        var head=document.getElementsByTagName("head")[0]; //head标签之间加上style样式
                        head.appendChild(style);
                    }
                    var cssText = "#weixin-tip{position: absolute; left:0; top:0; background: rgba(0,0,0,0.8); filter:alpha(opacity=80);  100%; height:960px; z-index: 1000;} #weixin-tip p{text-align: center; margin-top: 10%; padding:0 5%;}#wx-img{  95%; position: absolute;left: 15px;top: 0px;}";
    
                    if(isWeixin){
                        loadHtml();
                        loadStyleText(cssText);//如果是微信就显示图片
                    }
                    else{
                        location.href=downurl;//如果不是微信就显示下载
                    }
    </script>
    </body>
    </html>
  • 相关阅读:
    Vue 下拉刷新及无限加载组件
    VUE常用问题hack修改
    CSS滤镜让图片模糊(毛玻璃效果)实例页面
    滑动删除
    拖动选择单元格并合并方法
    Windows7上开启ftp服务器功能
    js 向上滚屏
    理解Clip Path
    图标制作
    transition实现图片轮播
  • 原文地址:https://www.cnblogs.com/shark1100913/p/8045846.html
Copyright © 2011-2022 走看看