【问题标题】:Issue with window.open alignment in IEIE 中的 window.open 对齐问题
【发布时间】:2019-12-13 01:00:47
【问题描述】:

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

在谷歌浏览器中左下角打开页面没有任何问题,但是当我们在IE中尝试打开窗口时,页面就像进入屏幕一样。

代码:

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

【问题讨论】:

  • 对于window.open() 的工作方式,除了请求窗口大小之外,您基本上无能为力,甚至可能会被用户浏览器设置覆盖(例如“始终在新选项卡中打开”)。
  • 可以发一下代码吗?
  • 谢谢,我在问题中添加了代码

标签: javascript html css internet-explorer


【解决方案1】:

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

<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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-12-09
    • 2019-05-24
    • 2011-05-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多