• HTML5 隐藏地址栏 兼容IOS 与安卓


     现在有一个问题: 如果手机是 一屏一屏的滑动的,就不能 隐藏了。

    来源:https://github.com/scottjehl/Hide-Address-Bar

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Test page</title><title>Cross-device Address Bar Hide - Example 1</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="hide-address-bar.js"></script>
        <style>
            /* DEMO ONLY for this short page - remove in live code */
            body { min-height: 480px; }
        </style>
    </head>
    <body>
    <p>The script on this page should hide the address bar on iOS and Android.</p>
    </body>
    </html>
    
        <script type="text/javascript">
            (function( win ){
                var doc = win.document;
    
                // If there's a hash, or addEventListener is undefined, stop here
                if(!win.navigator.standalone && !location.hash && win.addEventListener ){
    
                    //scroll to 1
                    win.scrollTo( 0, 1 );
                    var scrollTop = 1,
                        getScrollTop = function(){
                            return win.pageYOffset || doc.compatMode === "CSS1Compat" && doc.documentElement.scrollTop || doc.body.scrollTop || 0;
                        },
    
                    //reset to 0 on bodyready, if needed
                        bodycheck = setInterval(function(){
                            if( doc.body ){
                                clearInterval( bodycheck );
                                scrollTop = getScrollTop();
                                win.scrollTo( 0, scrollTop === 1 ? 0 : 1 );
                            }
                        }, 15 );
    
                    win.addEventListener( "load", function(){
                        setTimeout(function(){
                            //at load, if user hasn't scrolled more than 20 or so...
                            if( getScrollTop() < 20 ){
                                //reset to hide addr bar at onload
                                win.scrollTo( 0, scrollTop === 1 ? 0 : 1 );
                            }
                        }, 0);
                    }, false );
                }
            })( this );
        </script>
    View Code

    这两个 标签 也是隐藏 地址栏的,但是IOS 上苹果浏览器不起作用。

    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

     还有一个问题关于微信的

    用微信打开网页时, 用把 数字 变色 ,还可以拨号。 禁止这样情况 在网页头部加上:

    <meta content="telephone=no" name="format-detection" /> 

  • 相关阅读:
    进程详解
    java 实体对象与Map之间的转换工具类(自己还没看)
    fastjson中toString与toJSONString的差别
    JSONObject.toJSONString()包含或排除指定的属性
    FastJson中JSONObject用法及常用方法总结
    SpringBoot之ApplicationRunner接口和@Order注解
    shiro使用
    RedisTemplate 中 opsForHash()使用 (没有测试过,copy的)
    解决:javax.servlet.ServletException: Circular view path []: would dispatch back to the current....
    【Springboot】spring-boot-starter-redis包报错 :unknown
  • 原文地址:https://www.cnblogs.com/yjhua/p/4636363.html
Copyright © 2020-2023  润新知