Javascript Safari浏览器不支持screen.width和screen.height属性

Javascript Safari浏览器不支持screen.width和screen.height属性,javascript,browser,safari,Javascript,Browser,Safari,我有下面的代码,我试图打开屏幕中央的弹出窗口。这在Firefox、Chrome和IE中也能正常工作,但在Safari中不起作用。 我觉得Safari浏览器无法解释screen.width和screen.height属性。还是别的什么?我将感谢任何帮助!提前感谢: function openPopup(url){ var date = new Date(); //To uniquely identify a window, I'm appending this to the w

我有下面的代码,我试图打开屏幕中央的弹出窗口。这在Firefox、Chrome和IE中也能正常工作,但在Safari中不起作用。 我觉得Safari浏览器无法解释screen.width和screen.height属性。还是别的什么?我将感谢任何帮助!提前感谢:

   function openPopup(url){
       var date = new Date(); //To uniquely identify a window, I'm appending this to the window name.
       window.close(); //Closing the parent window.
       var width=650, height=375;
       var leftC =(screen.width / 2) - (width/ 2);
       var topC =(screen.height / 2) - (height / 2);
       window.open(url, "winName_"+date.getTime(), 'location=0, toolbar=no, scrollbars=0, resizable=no, width='+width+', height='+height+', top='+topC+', left='+leftC);            
}