Up until today, I was interested in writing a more object oriented version of the native window.open() function.  Unfortunately, I found out that there are some major incompatibility issues between browsers.  Let’s take this example for instance:

[sourcecode language=”js”]
window.open(“http://google.com/”, “”, “left=100,screenX=100,top=100,screenY=100,height=400”);
window.open(“http://google.com/”, “”, “left=100,screenX=100,top=100,screenY=100,width=400”);
[/sourcecode]

As you may have already guessed, the above code is simply supposed to open two new windows whose top, left corner is 100 pixels from both the top and left edge of the screen. The first window should have a height of 400 pixels and arbitrary width and the second should have a width of 400 pixels and arbitrary height. Ordinarily this code would work as expected, but on Google Chrome 10.0.648.204 and Mac OSX 10.6.5 the the windows end up being 22 pixels from the left and top of the screen. In addition, neither window has constrained the size of the window as I specified. After doing a little more testing to see if I could modify the values after creating the window, I realized that it may not be worth it to waste my time on this right now.

If you think you have found a solution to my problem, please let me know.

Categories: BlogJavaScript

Leave a Reply

Your email address will not be published. Required fields are marked *