javascript 在所有浏览器中隐藏地址栏

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16603308/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 05:18:13  来源:igfitidea点击:

Hiding address bar in all browsers

javascript

提问by Siva G

I need to hide the address bar of all browsers through my JavaScript code. Is it possible to do?

我需要通过我的 JavaScript 代码隐藏所有浏览器的地址栏。有可能吗?

Here is my code:

这是我的代码:

window.open("displayPdf.php?mnth="+mnth+"&year="+year+"&val="+newVal);
    dom.disable_window_open_feature.location
    dom.disable_window_open_feature.resizable
    dom.disable_window_open_feature.status

回答by Pekka

This is no longer possible in modern browsers due to security restrictions.

由于安全限制,这在现代浏览器中不再可能。

Official(-ish) Sources:

官方(-ish)来源:

  • Firefox

    In Firefox 3, dom.disable_window_open_feature.location now defaults to true, forcing the presence of the Location Bar much like in IE7. See bug 337344 for more information.

  • Internet Explorer 7 and later

    In Internet Explorer 6, location specifies whether to display the Address Bar.

    (Implying the behaviour ends with IE6)

  • Chrome/Chromium

    Those toolbar hiding parameters are ignored in Chrome. You will also notice that modern browsers are moving towards not hiding it as security / anti phishing measures. Also see https://bugzilla.mozilla.org/show_bug.cgi?id=337344

  • 火狐

    在 Firefox 3 中,dom.disable_window_open_feature.location 现在默认为 true,强制显示位置栏,就像在 IE7 中一样。有关更多信息,请参阅错误 337344。

  • Internet Explorer 7 及更高版本

    在 Internet Explorer 6 中,location 指定是否显示地址栏。

    (暗示行为以 IE6 结束)

  • 铬/铬

    Chrome 中会忽略这些工具栏隐藏参数。您还会注意到,现代浏览器正朝着不将其隐藏作为安全/反网络钓鱼措施的方向发展。另见https://bugzilla.mozilla.org/show_bug.cgi?id=337344

回答by Vikash Mishra

ClientScript.RegisterStartupScript(GetType(), "openwindow", "<script type=text/javascript> window.open('abc.aspx?id=" + str_id + "','null','location=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,addressbar=0,titlebar=no,directories=no,channelmode=no,status=no'); </script>");