Project

General

Profile

Internet Explorer goes to back of window stack when I open my web app

Added by Steve Drake almost 13 years ago

Using Wt 3.2.1, Internet Explorer 9.0.8112.16421 (update version 9.0.14) on Windows 7 (SP 1).

When I open my web app in IE 9 and my login screen is shown, I find that the IE window mysteriously goes to the back of the desktop window stack. In other words, if I have any other windows open (all are maximized), the IE window becomes hidden behind those other windows when IE navigates to my login screen. If I then click the IE button on the task bar twice, IE comes to the forefront again. This only happens with IE (not Opera, Firefox, Chrome or Safari).

My login screen consists of a dialog that inherits from WDialog. It shows a WImage, 2 WTextEdit fields for user name and password, a link for "forgot password" and a WPushButton to initiate the login.

The problem only happens at the login screen.

I have also found that if I have a second tab in IE, the problem does not occur.

Any ideas?


Replies (5)

RE: Internet Explorer goes to back of window stack when I open my web app - Added by Wim Dumon almost 13 years ago

Cannot reproduce this with hangman (publicly deployed) on IE10. However, I've noticed that other applications (not IE, but any other application) also do this on recent Windows versions. Maybe it's a MS policy to make users keep their desktops empty? :)

I have no idea. Can we test this on a public website?

BR,

Wim.

RE: Internet Explorer goes to back of window stack when I open my web app - Added by Steve Drake almost 13 years ago

I do not have a public web site where I can recreate the problem. But I do have a little more information, as I have continued to experiment on my own. I think it relates to the fact that I am using a dialog box for my login screen. I simplified the dialog until it contained only a button, and the problem still happens. However, when I change my app to simply display a piece of text instead of the dialog box, then the problem does not occur. I will continue to experiment and see what else I can learn.

Steve

RE: Internet Explorer goes to back of window stack when I open my web app - Added by Steve Drake almost 13 years ago

I have made a very minimal test app to recreate the problem. The attached .cpp file just creates a simple dialog box and the problem still occurs with IE 9. Should I be using something other than a WDialog for the login screen of my app?

main.cpp (2.64 KB) main.cpp

RE: Internet Explorer goes to back of window stack when I open my web app - Added by Wim Dumon almost 13 years ago

Hello Steve,

Can you try this patch?

@@ -397,8 +397,14 @@ void WDialog::setHidden(bool hidden, const WAnimation& an
        // of the dialog
        doJavaScript
          ("try {"
-          """if (document.activeElement && document.activeElement.blur)"
+           """var ae=document.activeElement;"
+           // On IE when a dialog is shown on startup, activeElement is the
+           // body. Bluring the body sends the window to the background if
+           // it is the only tab.
+           // http://redmine.emweb.be/boards/2/topics/6415
+          """if (ae && ae.blur && ae.nodeName != 'BODY') {"
           ""  "document.activeElement.blur();"
+           "}"
           "} catch (e) { }");
       } else
        restoreCoverState(app, cover);
    (1-5/5)