Pop up enabling - c#

I have a web app in ASP.NET, when you a click a link, am opening a pop up window in a new page, while i do that, if pop ups are disabled in end user computer, is there a way to detect that & enable pop up blockers? so that the new window can automatically open.
Thanks.

You cannot enable popups if they are blocked. It's a little different as to how to tell if your popup was blocked. See this answer Detect blocked popup in Chrome
The best thing to do is to detect if the popup was blocked and ask the used to allow popups for your site.

No, you can't control a person's browser settings from your website. That would be a big security problem and no body would have bothered implementing a pop-up blocker in the first place.
UPDATE:
See Bala's comment. One thing is detecting that it was blocked and another thing is changing the user's browser behavior.

Related

Disable prompts in Windows Forms Webbrowser

I have a C# application which uses a System.Windows.Forms.WebBrowser.
The problem is: i'd like the user to navigate smoothly in my application, without prompts, without javascript windows popping up, without security prompts. Even if this requires some contents to be unavailable.
I just want to have one window (always one window, if a receive a new window event, i redirect it to the single window).
How can i do this?
I tried to use this.browser.ScriptErrorsSuppressed = true but i doesnt seem to work.
For example, if i test it on a browser page which performs text validation, i still receive a popup window saying that my text is invalid.
Thank you!
I've found a solution somewhere else, since it wasn't available here.
Here it is: http://www.codeproject.com/Articles/31163/Suppressing-Hosted-WebBrowser-Control-Dialogs
Basically, you have to hook the WM_INITDIALOG message.
It works wonders here.

How to stop javascript errors from opening windows in WebBrowser

I have a webBrowser control that is used in the backend to navigate some sites. This is never actually shown to the user.
However, some sites have broken javascript and that causes a window to pop-up with the continue script or stop. The page still works, but I don't want this window to show up.
Besides removing the javascript at runtime from the page, is there anything else I can do to suppress them?
Managed to answer my own question, found on another forum.
webBrowser.ScriptErrorsSuppressed = true;

SpicIE toolbar, SHDocVw.IWebBrowser2 execScript problem?

I'm developing an addon for IE8+.
Main function:
- when I click the toolbar, it will display a box inside every single page, ex: google.com, bing.com, codeproject.com... by using execScript to execute jQuery.
Therefore, what Im doing is run javascript in the current page.
Everything has done except when that page perform an Pop-up, it doesnt work anymore.
I click the toolbar, nothing happen, but when I look at the pop-up, surprise! has the box which im trying to display. So, I think the current tab and the popup of its is running the same process.
I have change registry key TabProcGrowth to 20, to make sure every single tab run by its own process, but maybe it not work with popup.
sr for my bad english, any suggestion is welcome.
Thanks in advance.
update:
I have changed the way to develop my addon, so I change my question, too. (But any suggestion for the 1st question still very useful for me).
My new question still mention the "execScript" problem.
HOW to execute javascript with every individual tab of IE browser with TabProcGrowth = 0. I need this value set to 0 because I have the timer to request to the server every interval1 (ex: 60s). So if there are more than one processes of IE, the addon will send multi request to server at the sametime.
In my situation now, I set TabProcGrowth to 0. Open IE, open some tabs. Click the toolbar at the newest tab, it works, ofcourse!. But when I click toolbar at the old one, nothing happen. The script still be execute but it takes effect on the newest tab.
It's the big problem for me, resolve this problem, you guys save my life.

Deactivating Outlook window for a custom form

I'm currently writing an add-in where a pop-up box of choices appears when a certain action takes place. I'd like to make it so that the user can't continue in Outlook until they've either made a choice or cancelled the pop-up window.
I know how to do this for a static windows form-based application but seem to be running into difficulty and few answers (my google-fu is not coming up with anything right now).
Advice and assistance are welcome as always,
Larry
Call ShowDialog().

How do i close all open windows from my C# program?

Hi i have a windows application where i show a webbrowser, i have a button that removes the browser (its a preview) and goes to another "view" in my application (another tab). My problem is that my users are getting advanced, they build HTML with links (and its ok) but the links may spawn new browser windows (IExplorer), and my button needs to close these windows, but how?
I have made some code to traverse all eht windows that ends with "Windows Internet Explorer", ahd it all seems to work - but how do i close them? I am trying to do it like this:
SendMessage((int)hWnd, WM_SYSCOMMAND, SC_CLOSE, 0);
It seems to work, but the browser pops up a dialog asking me if i want to close the tab of all the tabs...how to work around/solve this?
Cheers,
walking over all top level iE windows and closing them is a bad idea, unless you are guaranteed users can't launch ie and browse the Internet on their own. Otherwise, you might actually lose user data (say an email or a blog post the user has been working on in the last half an hour)
You can't easily work around that dialog without modifying the per-user IE settings. Your other option is to look for that dialog and click the yes button, but that would be fragile and is not guaranteed to continue working if the user upgrades to IE9.
You could potentially prevent opening links in new window by listening to BeforeNavigate event and allowing only navigations that are guaranteed to happen in your control. However, there are scenarios where IE might still decide to open new window.

Categories