开发者

Popup in Safari OSX opens different size than Safari on Windows

I have this code

window.open(null, "window", "status = 0, height = " + WIZARD_HEIGHT - 50 + ", width = " + WIZARD_WIDTH - 50 + ", resizable = 0");

For some reason in Win开发者_如何学运维dows SAFARI it opens ok, but in MAC (OSX) it opens in full screen!

How can it be?

thank you


Instead of

"status = 0, height = " + WIZARD_HEIGHT - 50 + ", width = " + WIZARD_WIDTH - 50 

use

"status = 0, height = " + (WIZARD_HEIGHT - 50) + ", width = " + (WIZARD_WIDTH - 50)

Apparently the javascript engine of the latest Safari on OS X thinks

"status = 0, height = " + WIZARD_HEIGHT - 50

as

("status = 0, height = " + WIZARD_HEIGHT) - 50

and makes it into "NaN", as you can see by evaluating your string in Safari's debug console.

By the way, you know that Safari has the debug console, right? Go to the preferences, choose the detail tab, and check the "Show Developer menu" toolbox. Then you can open the web inspector, the javascript console, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜