JavaScript Window.Open location feature not working
In my window.open
I've set the location
to no
. As I understand it, this sh开发者_如何学Goould 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 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 complete "location" bar.
精彩评论