javascript - IE 中的 window.open 对齐问题

标签 javascript html css internet-explorer

我们在另一台服务器上托管了一个页面,当用户登录到我们的应用程序时,他们可以通过单击按钮导航到该外部页面。

在 Google chrome 中左下角打开的页面没有任何问题,但是当我们在 IE 中尝试时,窗口正在打开,但页面就像进入屏幕一样。 enter image description here

代码:

myWindow = window.open("mysite.com",
                       '',
                       'resizable=no, scrollbars=yes, status=yes, width=' + 1500 / systemZoom +
                       ', height=' + 500 / systemZoom +
                       ', top=' + top +
                       ', left=' + left);   

最佳答案

尝试使用以下代码显示弹窗:

<script type="text/javascript">
    function popupwindow(url, title, w, h) {
        var left = (screen.width / 2) - (w / 2);
        var top = (screen.height / 2) - (h / 2);
        window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);            
    } 
</script>

<a href="javascript:popupwindow('https://www.google.com','google','900','500');  ">This is the link</a>

关于javascript - IE 中的 window.open 对齐问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57359694/

相关文章:

html - Angular 错误 TS2531 : Object is possibly 'null'

php - Twig Assets 声明中的变量

html - 第一个列表项 (<li>) 在 google chrome 中向右浮动

css - 文本环绕响应图像

Javascript 如果单击特定键,我如何每 5 秒检查一次?

javascript - Vue.js 无法使用语义 UI 下拉菜单

javascript - Backbone 模型应该是 View 模型、领域模型还是两者兼而有之?

javascript - AJAX 获取查询不会导致页面加载

javascript - 让愚蠢的组件变得更聪明

javascript - 重叠的 HTML 元素