2

I want to open popup window using javascript with no title and address bar and also want to set its height and width in percentage according to screen resolution.How can i achieve this. I did this code;

 function popitup(url) {

        LeftPosition = (screen.width) ? (screen.width - 800) / 2 : 0;
        TopPosition = (screen.height) ? (screen.height - 700) / 2 : 0;
        var sheight = (screen.height) * 0.9;
        var swidth = (screen.width) * 0.8;          

        settings = 'height='+ sheight + ',width='+ swidth + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,resizable=yes,toolbar=no,status=no,menu=no, directories=no,titlebar=no,location=no,addressbar=no'

        newwindow = window.open(url, '', settings);
        if (window.focus) { newwindow.focus() }
        return false;
    }

but still i can see address and title bar.Is this is relative versions and type of browser?.If so how can i achieve these settings in latest versions of browser like IE9,Chrome,Firefox and safari?

4

2 回答 2

4

出于安全原因,这是不可能的。

查看 http://www.codeproject.com/Questions/79625/How-to-hide-title-bar-in-Javascript-popup

您可以使用更吸引人的模式对话框之类的替代方法。大多数 JS 库提供开箱即用的模式对话框或使用插件。

于 2012-11-01T10:21:14.567 回答
0

应该是menu = no还是menubar = no??

settings = 'width='+w+',height='+h+',top='+top+', left='+left+',menubar=no,resizable=no,scrollbars=yes,location=no,toolbar=no'对我来说很好。

于 2012-11-01T14:10:47.730 回答