How to move and resize the browser's window in Microsoft EDGE browser?

我的未来我决定 提交于 2019-12-06 03:32:48

问题


As per the Microsoft release update EDGE:

Window objects associated with frames are no longer affected by moveTo, moveBy, resizeTo, or resizeBy

In this case , How can we move a window to the desired location through JavaScript?

My code which is working across all browsers IE 11, Firefox, Chrome but not with EDGE.

my code:

    <!DOCTYPE html>
<html>
<body>

<button onclick="openWin()">Create new window</button>
<button onclick="moveWinTo()">Move new window</button>
<button onclick="moveWinBy()">Move the new window by 75 * 50px</button>

<script>
var myWindow;

function openWin() {
    myWindow = window.open("", "", "width=250, height=250");
}

function moveWinTo() {
    myWindow.moveTo(150, 150);
    myWindow.focus();
}

function moveWinBy() {
    myWindow.moveBy(75, 50);
    myWindow.focus();
}
</script>

</body>

[Edge] window.moveTo() doesnt work with EDGE

来源:https://stackoverflow.com/questions/33035167/how-to-move-and-resize-the-browsers-window-in-microsoft-edge-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!