Pop-up window that remembers its own position – part 2 – Opera

This is a continuation to my previous post where I claimed that IE is broken. Well, it seems that it is not the only one.
Opera has problems of its own kind. When it comes to positioning pop-up windows, there is a difference between the x and y you set and you get as well.
Moving a pop-up window moves its top left corner relatively to the top left corner of its parent window. Unlike in other browsers, where a new pop-up window is treated as equal to its parent, Opera opens a pop-up window as a new tab. This window appears on top of its parent’s window content, but its visibility is restricted to the parent’s content area.
opera0.png
In other words, the pop-up window cannot be dragged outside, e.g. you cannot place the pop-up and the parent windows side by side.
opera1.png
That would not be so bad, only if window.screenLeft and window.screenTop returned the values that were relative to its parent window. Unfortunately, that’s not the case. Opera returns x and y of the top left corner measured from the top left corner of the screen. That’s right, x and y are taken as if this pop-up window was a stand-alone window, not a child of the window that opened it.
So how did we fix this ‘bug’? We didn’t. What we did was
if (!window.opera) window.moveTo(x,y);
That’s right, we ignore Opera completely when it comes to positioning this pop-up window. Let’s let Opera decide where it pops windows up. Don’t you love browser differences?!
Peace!

Published

in

Related Content

More in ‘
Featured Article
Announcing social enterprise discounts: Atlassian tools for social impact teams
Featured Article
Great managers meet uncertainty with curiosity and confidence
Featured Article
Introducing Databricks Query Runner: Transforming data into insight
Featured Article
Team ’25 Europe: AI that’s changing the game for teams

More Collections

Meet Rovo everywhere: AI that connects every app, every team, every workflow

Introducing Atlassian Software Collection

Move Faster and Work Smarter with Atlassian’s AI-Powered Teamwork Collection