Hiding browser address bar without reloading

微笑、不失礼 提交于 2019-12-18 09:53:32

问题


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 opened from local disk and I don't want the address bar to show the horrible and confusing file:// etc URL).

Is this possible, and if so, how?


回答1:


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.




回答2:


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...




回答3:


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




回答4:


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


来源:https://stackoverflow.com/questions/1716313/hiding-browser-address-bar-without-reloading

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!