Jus*_*808 5 javascript google-chrome window.open
在chrome中打开弹出窗口时,大多数情况下它不是请求的大小.似乎我第一次打开窗户时它的大小正确,但是如果我将它关闭并再次打开它,它的全部形状都会变形.
我需要做些什么特别的铬吗?
偶然发现这个,可能对你有好处:
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)
| 归档时间: |
|
| 查看次数: |
1334 次 |
| 最近记录: |