have u checked if the pdisp (parameter of beforenavigate
is <> from browser.defaultinterface. I use it to make difference between frames
and maindocument.
--- In delphi-webbrowser@yahoogroups.com, "crulex32" <crulex@...> wrote:
>
> Hi,
>
> I'm developing a .NET application that involves recording macros from within
Internet Explorer sidebar (as well as external application hosting MS WebBrowser
control that does the same thing).
>
> I need to detect when the navigation event (e.g. BeforeNavigate2 or
DocumentCompleted) is initiated from the Address Bar, rather than clicking links
or any AJAX/script on the page.
> (Actually I don't care much about AJAX for now, but I need at least filter any
navigation initiated by clicking links).
>
> My first idea (seems not very straightforward though is:
> 1. When a link/button is clicked within the WebBrowser, set a flag indicating
that navigation was caused by clicking a link.
> 2. See if any Navigating or Navigated event occurs during some timeout after
the link was clicked. If none, assume that the link/button doesn't lead to
navigating to other page.
> 3. When the DocumentCompleted event fires, reset the flag (which was set at
#1). If the flag was not set, assume that the call was initiated from address
bar.
> Need to handle possible redirection somehow as well.
>
> Other ideas include:
> - like my first idea, but analyze the link/button to see if it will produce
navigation event or not. So, we won't need the step #2.
> - detecting mouse clicks/keystrokes when the address bar is active (VERY
unwanted because of possible issues with Protected Mode and IE8 threading
model).
>
> I'd appreciate any hint or sharing your practical experience regarding this.
>
> (Note, I'm using C#/.NET 3.5 here but it shouldn't matter much, I'm not less
familiar with Delphi and Visual C++).
>
> Thanks in advance for your help
>