Javascript 无法使用window.open()定位窗口

Javascript 无法使用window.open()定位窗口,javascript,window.open,Javascript,Window.open,我的目标是在屏幕右下角放置一个用window.open()方法打开的新窗口,但是设置right=0和bottom=0不起作用 更改宽度和高度会有所不同,但更改顶部、底部、右侧或左侧仍会导致窗口在左上角打开 为什么会这样?如何将窗口定位在右下角 window.open('https://google.com', '_blank', 'location=yes, height=250,width=550, right=0, bottom=0, scrollbars=yes,status=yes');

我的目标是在屏幕右下角放置一个用
window.open()
方法打开的新窗口,但是设置
right=0
bottom=0
不起作用

更改
宽度
高度
会有所不同,但更改
顶部
底部
右侧
左侧
仍会导致窗口在左上角打开

为什么会这样?如何将窗口定位在右下角

window.open('https://google.com', '_blank', 'location=yes, height=250,width=550, right=0, bottom=0, scrollbars=yes,status=yes');  

您需要将顶部和左侧设置为内部高度和宽度减去新窗口的高度和宽度

<script>
    function OpenMe(){
    var height = 250;
    var width = 550;
    var top = window.innerHeight-height;
    var left = window.innerHeight-width;
    window.open(
        'https://google.com', 
        '_blank', 
        'location=yes,height='+height+',width='+width+',top='+top+',left='+left+',scrollbars=yes,status=yes'
    );
    }
</script>

函数OpenMe(){
var高度=250;
var宽度=550;
var top=window.innerHeight-height;
var left=window.innerHeight-width;
打开窗户(
'https://google.com', 
"空白",,
'location=yes,height='+height+',width='+width+',top='+top+',left='+left+',滚动条=yes,status=yes'
);
}

您需要将顶部和左侧设置为内部高度和宽度减去新窗口的高度和宽度

<script>
    function OpenMe(){
    var height = 250;
    var width = 550;
    var top = window.innerHeight-height;
    var left = window.innerHeight-width;
    window.open(
        'https://google.com', 
        '_blank', 
        'location=yes,height='+height+',width='+width+',top='+top+',left='+left+',scrollbars=yes,status=yes'
    );
    }
</script>

函数OpenMe(){
var高度=250;
var宽度=550;
var top=window.innerHeight-height;
var left=window.innerHeight-width;
打开窗户(
'https://google.com', 
"空白",,
'location=yes,height='+height+',width='+width+',top='+top+',left='+left+',滚动条=yes,status=yes'
);
}

您能测试我的答案吗?您解决了您遇到的问题吗?不是解决方案,但在
windowFeatures
参数中不允许有空格。您能测试我的答案吗?您是否解决了您遇到的问题?不是解决方案,而是
windowFeatures
参数中不允许有空格。