Search the web
Sign In
New User? Sign Up
delphi-webbrowser · Delphi: Using IE's WebBrowser
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Detecting navigation initiated from address bar   Message List  
Reply | Forward Message #10258 of 10267 |
RE: [Delphi-WebBrowser] Re: Detecting navigation initiated from address bar

Hi,

> I need at least filter any
> navigation initiated by clicking links


1'st problem
as the normal event mechanism will give you the mouse click AFTER the
navigation is initiated you might run into some timing issues

2'end problem
by {Ctrl + click} or {Ctrl + Shift + click} navigation you'll never
receive the DocumentCompleted event -> it'll happen in another browser
instance


The only solution I can think of is to implement IHtmlEditDesigner witch
will give you the click before IE gets a chance to se it.

Although the name IHtmlEditDesigner implies editing the document content
its really just an interface that intercepts mshtml events at certain
points of the event bubbling process.

After implementing the IHtmlEditDesigner and attaching it to your
browser instance (via a IHTMLEditServices.AddDesigner call) the
IHtmlEditDesigner.PreHandleEvent will give you the mouse click before
any navigation is initiated.

After having received a mouse click you can investigate the
IHTMLEventObj given to you by the PreHandleEvent and if the
IHTMLEventObj.srcElement contains a link element you can check
IHTMLEventObj.shiftKey and IHTMLEventObj.ctrlKey to see if the link will
navigate inside your current browser instance or to a new browser
instance.

If the link will navigate inside your current browser instance store the
link and wait for it to appear at DocumentCompleted. If another URL
turns up at DocumentCompleted you'll know a redirection has been
involved.

One extra benefit often asked fore is that
IHtmlEditDesigner.PreHandleEvent enables you to cancel the event and
avoid any navigation.
Say you wont let your users click-navigate outside your company intranet
except in certain time periods :-)
Although such a "filter" would need to be implemented in a BHO to be
effective.

-Kurt


-----Original Message-----
From: delphi-webbrowser@yahoogroups.com
[mailto:delphi-webbrowser@yahoogroups.com] On Behalf Of crulex32
Sent: 16. april 2009 01-08
To: delphi-webbrowser@yahoogroups.com
Subject: [Delphi-WebBrowser] Re: Detecting navigation initiated from
address bar

Hi!

Thanks for getting back, though this doesn't seem to apply to my need.
I need to differentiate between (top level frame) navigation initiated
from address bar, or from clicking a link within browser.

I know that I can check for pDisp parameter in BeforeNavigate but I
think this won't give me the info I need above.

Thanks




Thu Apr 16, 2009 6:53 am

lexicalis
Offline Offline
Send Email Send Email

Forward
Message #10258 of 10267 |
Expand Messages Author Sort by Date

Hi, I'm developing a .NET application that involves recording macros from within Internet Explorer sidebar (as well as external application hosting MS...
crulex32
Offline Send Email
Mar 30, 2009
12:04 am

have u checked if the pdisp (parameter of beforenavigate is <> from browser.defaultinterface. I use it to make difference between frames and maindocument....
cedmart1_fr
Offline Send Email
Mar 30, 2009
6:38 am

Hi! Thanks for getting back, though this doesn't seem to apply to my need. I need to differentiate between (top level frame) navigation initiated from address...
crulex32
Offline Send Email
Apr 15, 2009
11:08 pm

Hi, ... 1'st problem as the normal event mechanism will give you the mouse click AFTER the navigation is initiated you might run into some timing issues 2'end...
Senfer, Kurt
lexicalis
Offline Send Email
Apr 16, 2009
6:54 am

Thanks for the help Kurt! I'm unsure yet if I'll actually proceed with implementing IHtmlEditDesigner - might be in the next version of software I'm...
crulex32
Offline Send Email
Apr 28, 2009
1:24 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help