在html文件中禁用浏览器中的地址栏和后退按钮

问题描述 投票:0回答:2

如何在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数据和禁用的地址栏,没有后退按钮。

怎么做?

javascript jquery html
2个回答
1
投票

你可以这样试试

<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');" />

顶级浏览器支持此功能


0
投票

JavaScript API存在,只是由于安全问题,浏览器供应商禁用了地址栏的隐藏。

Hiding the address bar of a browser

相反,您可以在浏览器窗口中创建一个模态。 Twitter Bootstrap或类似的东西:http://sandbox.scriptiny.com/tinybox2/

© www.soinside.com 2019 - 2024. All rights reserved.