javascript window.open不是chrome中请求的大小

Jus*_*808 5 javascript google-chrome window.open

在chrome中打开弹出窗口时,大多数情况下它不是请求的大小.似乎我第一次打开窗户时它的大小正确,但是如果我将它关闭并再次打开它,它的全部形状都会变形.

我需要做些什么特别的铬吗?

mic*_*rry 0

偶然发现这个,可能对你有好处:

http://roneiv.wordpress.com/2008/01/18/open-a-popup-window-in-javascript-with-windowopen-crossbrowser-solution/

var myPopupWindow = '';
function openPopupWindow(url, name, width, height)
{
    //Remove special characters from name
    name = name.replace(/\/|\-|\./gi, "");

    //Remove whitespaces from name
    var whitespace = new RegExp("\\s","g");
    name = name.replace(whitespace,"");

    //If it is already open
    if (!myPopupWindow.closed && myPopupWindow.location)
    {
        myPopupWindow.location.href = encodeUrl(url);
    }
    else
    {
        myPopupWindow= window.open(encodeUrl(url),name, "location=no, scrollbars=yes, resizable=yes, toolbar=no, menubar=no, width=" + width + ", height=" + height );
        if (!myPopupWindow.opener) myPopupWindow.opener = self;
    }

     //If my main window has focus - set it to the popup
    if (window.focus) {myPopupWindow.focus()}
}
Run Code Online (Sandbox Code Playgroud)