c# - webbrowser iframes open in default browser -
I've got webbroser control to open links in my default browser:
private Zero WebBrowser1_Navigating (Object Sender, WebBrowserNavigatingEventArgs e) {if (e.Ull.ToString ()! = "About: Blank") {e.Cancel = true; System.Diagnostics.Process.Start (e.Url.ToString ()); }}
This works very well, but if I load a document that contains some iframe elements which will be opened in the system browser (most embedded stuff like Google Maps, dig icon , e.t.c) ..).
How do I keep loading iframes in web browser control and the user clicks the link in the browser? I came to the conclusion that the .NET WebBrowser component is almost useless in this regard. I have tried to read WebBrowserNavigatingEventArgs.TargetFrameName
but if the element of ifframe element is only in the HTML document, it will return the name
attribute, otherwise it would be an empty " "
will spit the string. Getting zero on non-frame links would be more helpful.
So I have found only one fix, this is using the X-Bebbrozer control, and especially listening to the BeforeNavigate2 event. I have not tested as much as I should, but it appears that when the user triggers the "flag" property in DWebBrowserEvents2_BeforeNavigate2Event
set to 64 goes.
Private Voiced Aquibriver 1_BEforeNavigate2 (Object Sender, AXSHQQV.VibBrojEreEvents 2_BEforeNavigate2Event E) {// 64 means that the user is triggered ((int) e.flag == 64 and E .URL.trustring ()! = "About: Blank") {e.cancel = true; System.Diagnostics.Process.Start (e.uRL.ToString ()); }}
MSDN Docs says that flag
is an IE7 + parameter only, so I do not know what happens on IE6 machines ... < / P>
There is some very important information about the ExDbroubler.
Comments
Post a Comment