js 屏蔽浏览器的地址栏和工具栏

JavaScript011

js 屏蔽浏览器的地址栏和工具栏,第1张

window.open(...location=no...)

这种写法IE6以上不支持,谷歌不支持

两种方案可以解决:

1、不弹出OPEN,弹出一个DIV,然后DIV里内嵌一个IFRAME,IFRAME的地址是'page.html';

2、使用模式窗体,自度。

window.addEventListener("load",function() {

  setTimeout(function(){

    window.scrollTo(0, 1)

  }, 0)

})

这种是在你浏览器内容高于浏览器的时候才会有用

if(document.documentElement.scrollHeight <= document.documentElement.clientHeight) {

bodyTag = document.getElementsByTagName('body')[0]

bodyTag.style.height = document.documentElement.clientWidth / screen.width * screen.height + 'px'

这个是内容没有浏览器高的情况下

综合一下:

<script>  

            window.onload=function(){  

                if(document.documentElement.scrollHeight <= document.documentElement.clientHeight) {  

                    bodyTag = document.getElementsByTagName('body')[0]  

                    bodyTag.style.height = document.documentElement.clientWidth / screen.width * screen.height + 'px'  

                }  

                setTimeout(function() {  

                    window.scrollTo(0, 1)  

                }, 0)  

            }  

        </script>

试试看吧