Intercepting Naviagation on Web Browser

N

Neil D

Hi

Does anyone know if it's possible to host a web browser control and
intercept the navigating event. I want to trap this event and stop the
control browsing to the the linked page/resource and do something else.
I've done quite a bit of research on this but so far haven't found a
solution. I've tried using cf 2.0 on windows mobile 5.0 and the included
webbrowser control and can apture the event but I can't stop the page
changing. I've also tried using the OpenNET SDF 1.4 and can trap the
navigating event but not stop it with the included WebBrowser control. I've
also seen Alex Feinman's examples of hosting Flash and WMP ocx controls,
should I look at doing the same with the PIEWebBrowser? Ideally I'd like to
do this in cf 1.0 on pocket pc 2003 se, but if i need to use cf2.0 and/or
windows mobile 5.0 that's not really a problem.

Any advice gratefully recieved.

Thanks

Neil
 
N

Neil D

I'm surprised that there is nobody that can shed some light on why this
doesn't work on the compact framework. On the desktop it does.

Just add the new webbrowser control and create an event:

private void webBrowser1_Navigating(object sender,
WebBrowserNavigatingEventArgs e) {

e.Cancel = true;

}

Should stop the navigation but it doesn't.
 
P

Paul G. Tobey [eMVP]

Ignoring whether it makes sense to expect CE to work just like the desktop,
if you look at the source code for the IESample browser
(PUBLIC\IE\OAK\IESAMPLE\CORE), for which you'll need to download Windows CE
5.0 with Platform Builder Evaluation Version from the Microsoft download
site, I think that you'll see that you can find a connection point for the
browser object and can hook up a handler. I think that the event that you
want is DISPID_BEFORENAVIGATE2. As far as cancelling the navigation, I'm
afraid I don't know how that works.

Paul T.
 
R

Robert Levy [MS]

pvbCancel on BeforeNavigate2 unfortuantely does not work right now.

This got fixed in a later build of Windows Mobile 5 though so many *future*
WM5 devices will have it working (specifically, those that have the MSFP
included in ROM)\
 
N

Neil D

Rob

Thanks for the response.

So is there a workaround for it? Would using the new activex hosting
facilities to wrap the new browser control provide a solution?

Is it fixed in the emulator ROMS and how is it possible to tell if it is
fixed on a device. If the MSFP is installed then can I assume that it is
fixed and is there anywhere I can get a list of devices that will have
shipped with the MSFP or details of whether the MSFP is included in the
update ROM's (such as the update available for IPAQ 4700 and 2100 series)?

Finally I've seen no mention of this problem on MSDN is it documented?

Thanks

Neil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top