我有这段代码
window.open(null, "window", "status = 0, height = " + WIZARD_HEIGHT - 50 + ", width = " + WIZARD_WIDTH - 50 + ", resizable = 0");
出于某种原因,在Windows SAFARI中它打开正常,但在MAC(OSX)中它会全屏打开!
怎么可能?
谢谢
答案 0 :(得分:2)
而不是
"status = 0, height = " + WIZARD_HEIGHT - 50 + ", width = " + WIZARD_WIDTH - 50
使用
"status = 0, height = " + (WIZARD_HEIGHT - 50) + ", width = " + (WIZARD_WIDTH - 50)
显然,OS X上最新Safari的javascript引擎认为
"status = 0, height = " + WIZARD_HEIGHT - 50
as
("status = 0, height = " + WIZARD_HEIGHT) - 50
并将其变为“NaN”,您可以通过在Safari的调试控制台中评估字符串来看到。
顺便说一下,你知道Safari有调试控制台,对吗?转到首选项,选择详细信息选项卡,然后选中“显示开发人员菜单”工具箱。然后,您可以打开Web检查器,javascript控制台等。