I need to know in my app if a modal window is opened when I click on a button.
So I'm searching for a method which permits to know if a modal window is opened in my application or no, and which returns the window (or NULL)
Is it possible?
See QApplication's static activeModalWidget
i want to open a popup window when user leaves tab or closes browser, the available option with me was window.open, but with that, it asks for popup blocker, if it is not enabled, i tried every possible ways to ignore popup-blocker but in vain, i tried onunload, onbeforeunload, but it does not works, i also tried to use modal dialog, before the tab/browser, i used it in onbeforeunload event, but it shows a browsers alert message, which i dont want, my simple requirement is, i need a popup window (if possible) or modal dialog, on the close of tab/browser, but should ignore popup-blocker, i guess with modal dialog, i dont need to worry about popup-blocker, because that wont be the new window, but how i would be handling it, while user closes tab/browser. If any of the above option is not possible, can anyone help me with any other possible alternative, or helpful articles.
Edited Question
i used the below script and with that i can open a new popup window on link click, without popup-blocker interfering in it
$('a[href=http://www.google.com]').click(function(){
window.open(this.href);
return false;
});
then why its not possible for the closing events.
You can't - because that's what popup blockers do: they block popup windows (i.e. calls to window.open or invocations of target="_blank" links) unless it is directly in response to a user mouse action.
Opening popups when a browser window is closed was a common tactic of "pop-under" ads in the early 2000s, and it irritated users, that's why Firefox and IE6's popup blocker block them, and there is no way around it for you unless you ask the user to disable their popup blocker on your site (and I think you'll find most of them will have no idea how to do that).
What are you trying to accomplish anyway? What is the content of this popup that you want the user to see? What other approaches have you tried?
Exact duplicate of your previous question....
I'll post my answer for it here as well though...
Popup blockers are designed to prevent this behavior.
I would suggest using a modal window instead of an actual browser window. I don't think that these get blocked because they are opened within the page itself.
As for the event... You could do something like...
window.onbeforeunload = function whatever() {
//Do code here for your modal to show up.
}
If you are just trying ot give a warning or something you could do
window.onbeforeunload = function showWarning() {
returnString = 'Whatever you want your message to be....';
return returnString;
}
By returning something in the onbeforeunload statement it will show a confirm box with your message in it.
Popup blocker will not block the opening of popups if the javascript code which opens the popup is executed on user's direct action like click, keypress, drag, etc.
I implemented an class, this class will show an tray icon. to handle the message from the icon, I have to create a hidden window.
Eevery thing works fine, except if You click outside of the icon, icon will not disappear. I have fixed this by adding code below:
SetForegroundWindow(message-only-hiden-window) // added
TrackPopupMenu()
RESOLUTION:To correct the first behavior, you need to make the current window the foreground window before calling TrackPopupMenu or TrackPopupMenuEx.
Now I get the expect result: the menu can disappear if you click outside of the tray icon.
The problem is now, after the call of SetForegroundWindow(message-only-hiden-window) the main app window will no responding(cannot resize move) I can see the main window actually get those messages in spy++.
Keep this the mind if no call on SetForegroundWindow(message-only-hiden-window). Fine. Except the menu will not disappear.
Anyone has experience on similar situation?
How do you implement an tray icon which has no foreground window at all?
Any kind of help will be appreciated. If you wanna the source code I can email you.
resolved. I have forgot return DefWindowProc in the message only window. tricky
I am not able to handle Iframe popups. In my application when i click on some buttons or link then open iframe pop up. activity which i do on that iframe popup is not recorded in selenium IDE.
select window command also not work.
When i click on link then it open in second window with same title. i am not able to handle that new window's activity.
Please provide me solution if any have.
You need to use the command Select Frame and not Select Window.
I have a popup button that launches a canvas containing a form that a user can submit. I'm validating this form and displaying an alert when the validation fails. As soon as the user clicks 'OK' on the alert, the canvas launched from the PopUpButton loses focus and closes automatically (its default behavior). PopUpButton._closeOnActivity is private. Any suggestions are greatly appreciated.
Use PopUpManager and a normal button to pop something up manually instead of using a PopUpButton. You can then open and close it when you want to and avoid the default behavior.
var canvas:Canvas = new Canvas();
PopUpManager.addPopUp(canvas, this);
PopUpManager.centerPopUp(canvas);
PopUpManager.removePopUp(canvas);