We are building a custom web browser using CefSharp WinForms (version 71.0.2.0) and need to open a popup form containing a browser control. This popup must not steal focus from any other window the user has open (the current app and any others they are working in) but must pop up in front of any others.
We have successfully managed this in a previous version of the application which used a different Chrome wrapper.
Whatever I try I cannot get it to work.
Using the following:
frm.Visible = false;
frm.TopMost = false;
ShowWindow(frm.Handle, SW_SHOWNOACTIVATE);
SetWindowPos((int)frm.Handle, HWND_TOPMOST,frm.Left, frm.Top, frm.Width, frm.Height,SWP_NOACTIVATE);
frm.Visible = true; //So that Load event happens
shows an inactive window if I don't include a browser on it, when I add a browser window and call the above it steals focus.
So I'm looking to have my app open a modal popup window if a user tries to navigate away from a page or close the tab/browser with unsaved data on a form.
I've had people tell me this isn't possible as angular makes asynchronous callbacks and as such once you stop the event in order to open the modal and prevent the navigation the contents of the event are lost.
Is it possible to store the contents of the event in an object?
From one of our application, we are calling window.open() method to open a pop up. When we are using this, the browsers are blocking the popup and user has to disable popup blocker for the specified web site.
Is there any way to disable the popup blockers for specified URL patterns(With out user intervention),like using browser API etc...
No. There is no way to alter the browser's popup blocker behaviour from within a webpage. The best you can do is include a message on your website asking people to turn off their popup blockers while using your site so that the site can function properly.
There are Ok and Cancel buttons in a silverlight window.
When clicking cancel button on that window how can I close the window?
If the SilverLight application is hosted in a WebBrowser then you can redirect the browser to another page:
HtmlPage.Window.Navigate(new Uri("../Login/Login.aspx", UriKind.Relative));
U can use next statement:
System.Windows.Browser.HtmlPage.Window.Invoke("close");
I have the developer toolbar for IE7, which is great when I want to inspect the page layout in a fashion similar to the functionality of firebug for firefox.
However I am working with a web site that opens a new window with the toolbars disabled, and I cannot access my dev toolbar button! Is there a way to force IE7 to always show the toolbar?
I don't believe you can.
You can recover the navigation toolbar (back, forward, address bar, search box) in a chromeless window (one opened without navigation toolbar, menus, other toolbars) by hitting F11, then F11 again, but that still doesn't give you access to the IE Developer Toolbar.
What will sometimes work is to hit CTRL+N while the new, chromeless window has focus. Doing that will open a new chromed (toolbars, menus, etc) to the same URL as the chromeless window. The trick won't work very well if the chromeless window URL is the result of a POST, or does a GET that modifies state in some way on the server.
I imagine that this happens because the pop-up window is opened using a javascript window.open() call specifying not to have the toolbars on the new window?
One possibility is opening the page source, finding the javascript call that opens the window, and pasting it into the address bar, modifying it to not disable toolbars.
For example, if the call currently looks like:
window.open(url, "newWindow", "toolbar=no,width=500,...");
Edit the address bar to read something like:
javascript:window.open(url, "newWindow", "toolbar=yes,width=500,...");
When you push enter on that, it should pop up the window just the same, but with toolbars.
IE8 has the dev toolbar built-in, so you can always access it via F12. Consider upgrading?