簡體   English   中英

在html文件中禁用瀏覽器中的地址欄和后退按鈕

[英]Disable address bar and back button in browser in html file

如何禁用HTML文件中瀏覽器中的地址欄和后退按鈕?

像這樣的東西:

這是演示: http : //jsfiddle.net/n5pKP/5/

JS:

$('.popup').click(function () {
    var curr_browser = navigator.appName;
    if (curr_browser == "Microsoft Internet Explorer") {
        window.opener = self;
    }
    window.open('http://www.google.com/', 'null', 'width=900,height=750,toolbar=no,scrollbars=no,location=no,resizable =no');
    window.moveTo(0, 0);
    window.resizeTo(screen.width, screen.height - 100);
});

HTML:

<a target="_parent" href="javascript:void(0);" class="popup">Open new window</a> 

現在點擊即可打開。 我想直接將其作為彈出窗口打開。 就像我雙擊test.html一樣,它應該顯示我的html數據和禁用的地址欄,並且沒有后退按鈕。

怎么做?

你可以這樣嘗試

<input id="Button1" type="button" value="button" onclick="window.open('WebForm1.aspx','PoP_Up','directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=1024,height=768');" />

頂級瀏覽器支持

存在JavaScript API,只是由於安全問題,瀏覽器供應商禁止隱藏地址欄。

隱藏瀏覽器的地址欄

相反,您可以在瀏覽器窗口中創建模態。 Twitter Bootstrap或類似的東西: http : //sandbox.scriptiny.com/tinybox2/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM