Hiding browser address bar without reloading

前端 未结 4 505
天命终不由人
天命终不由人 2021-01-26 05:18

I would like dynamically (via JavaScript) hide the address bar. I realize this can be done when opening a pop-up, but in this case I don\'t have the luxury (the file is being op

相关标签:
4条回答
  • 2021-01-26 05:31

    This javascript will open a browser window in Internet Explorer from a batch file, without showing the location bar.

    Replace all instances of # with <

    **OPEN.BAT -**
    
    echo ^#html^> >> %temp%\temp.htm
    
    echo ^#head^> >> %temp%\temp.htm
    
    echo ^#title^>^#/title^> >> %temp%\temp.htm
    
    echo ^#script language='JavaScript' type='text/javascript'^>function run(){window.open('','_self');var t = openWin(newWin())}function newWin(){window.open('http://www.bbc.co.uk','','location=0');window.close()}^#/script^> >> %temp%\temp.htm
    
    echo ^#/head^> >> %temp%\temp.htm
    
    echo ^#body onload='run()'^> ^#/body^> >> %temp%\temp.htm
    
    echo ^#/html^> >> %temp%\temp.htm
    
    "C:\Program Files\Internet Explorer\IEXPLORE.EXE" %temp%\temp.htm
    
    0 讨论(0)
  • 2021-01-26 05:38

    Don't forget that IE is not the only browser in the world. Firefox, for example, shows the address even in popup windows.

    This behaviour is by design. Pages are not supposed to interfere with the browser chrome too much. Therefore, even if you find a way to suppress the address bar for a given browser, you may find it stops working in future patches.

    Think how much easier it would be to operate phishing attacks if you could trivially conceal the location of the document from the user...

    0 讨论(0)
  • 2021-01-26 05:42

    If your code will always be running from local disk you can hide the title bar and the address bar using an HTA.

    0 讨论(0)
  • 2021-01-26 05:45

    It isn't possible to change those settings once the window is open. Imagine how annoying that would be if sites could remove the address bar to stop you from leaving their site. In my experience most users never look at the address bar once they have plunked facebok.com into it.

    0 讨论(0)
提交回复
热议问题