最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

JavaScript Window.Open location feature not working - Stack Overflow

programmeradmin1浏览0评论

In my window.open I've set the location to no. As I understand it, this should open a popup window with no address bar. However, when the popup window appears it has an address bar in all browsers except for Safari. How can I open a new window without an address bar?

<script type="text/javascript" language="javascript">
$(document).ready(function() {

    var win = window.open("<%= Uri %>", "_blank", "directories=no,location=no,menubar=no,titlebar=no,toolbar=no,status=no");
    if (win != undefined) {
        window.location.href = '<%= this.Request.UrlReferrer.AbsoluteUri %>';
    }
});

In my window.open I've set the location to no. As I understand it, this should open a popup window with no address bar. However, when the popup window appears it has an address bar in all browsers except for Safari. How can I open a new window without an address bar?

<script type="text/javascript" language="javascript">
$(document).ready(function() {

    var win = window.open("<%= Uri %>", "_blank", "directories=no,location=no,menubar=no,titlebar=no,toolbar=no,status=no");
    if (win != undefined) {
        window.location.href = '<%= this.Request.UrlReferrer.AbsoluteUri %>';
    }
});

Share Improve this question asked Aug 25, 2010 at 21:49 Aaron SalazarAaron Salazar 4,53710 gold badges43 silver badges55 bronze badges 2
  • Many browsers don't let you disable some features due to security reasons – Rafael Commented Aug 25, 2010 at 21:53
  • newer browsers don't let you do evil things like that. – DA. Commented Aug 25, 2010 at 22:06
Add a ment  | 

1 Answer 1

Reset to default 4

In general, you can never guarantee that the user won't see window features you ask to be hidden, because some browsers (Firefox, I know, and maybe others) allow the browser user to control what features can be disabled. On top of that, some plugins add toolbars and don't pay any attention to those parameters to window.open.

That said, that parameter usually works, as I've successfully used it, and it works in cooperating browsers (including all versions of IE I've tried).

edit — I just tried a quick test and it seems to work just fine in Chrome and IE. Now, Chrome shows a little indicator area at the window top that shows the URL, but it's not really the plete "location" bar.

发布评论

评论列表(0)

  1. 暂无评论