I'm having problems with synchronism in my aplication. Only one window can be exist, if any user try to access the same page in other window the system should close this window, restore the first window and show a message like: "Duplicated Instance of ... "
To do this I used Javascript Native, however, it somes like happening some kind of synchronism problem.
Sometimes works, sometimes not, I tried to use timers, but doesn't help very much, it is very unstable, like this:

Timer t = new Timer() {
@Override
public void run() {
if(GXT.isIE) {
focusWindow();
} else {
resizeWindow();
}

final MessageBox box;
box = MessageBox.alert(
"Duplicated Instance... ",
"...",
new Listener<MessageBoxEvent>() {
@Override
public void handleEvent(final MessageBoxEvent be) {
}
});

Timer timer = new Timer() {
@Override
public void run() {
box.close();
return;
}
};
timer.schedule(5000);
return ;
}
};
t.schedule(300);

/**
* Used to focus on the principal window
* Works only with IE
*/
public static native void focusWindow() /*-{
this.focus();
}-*/;


/**
* Resize the principal window
*/
public static native void resizeWindow() /*-{
top.window.moveTo(0,0);
if (document.all) {
top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else if (document.layers || document.getElementById) {
if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
}
}
}-*/;

Does anybody know how can I solve this problem? Preferentially using GWT ?