Viktor78


Hello,

I have discovered that IE7 does not call the DWebBrowserEvents2 event BEFORENAVIGATE2 any more when the user clicks on a javascript link.

The event was invoked in IE6 and allowed BHOs to handle javascript links. Before IE7 it was possible to cancel, modify or otherwise react on javascript invocations. I used this functionality to implement a pop-up blocker for IE.

Example Code

<html>
<body>
<a href="j a v a s c r i p t : alert('pop-up');">Pop-Up</a>
</body>
</html>

// added spaces between "j a v a s c r ip t :" to be able to post the code

Please call the BeforeNavigate2 event again for backward-compatability reasons or introduce a new event whenever a javascript link is activated by the user.

Thanks

Viktor
--
http://www.quero.at/
The New Web Experience



Re: Internet Explorer Extension Development IE7: BeforeNavigate2 not called any more on javascript links

Reza Nourai - MSFT

The BeforeNavigate2 code has not been removed or changed in any way. It should be firing.

Are you able to catch any of the other WebBrowser events We made a change that seperated our code from Windows Explorer Shell by moving the browser code out from SHDocVw.dll and into IEFrame.dll, so is it possible you are pulling the event handler from SHDocVw.dll

Please give us some more information and I can try to help.

-Reza





Re: Internet Explorer Extension Development IE7: BeforeNavigate2 not called any more on javascript links

Viktor78

>The BeforeNavigate2 code has not been removed or changed in any way. It should be firing.

Unfortunately, it is not firing for javascript links any more like when the user clicks on the link given in the example above. Catching other types of navigation like to an http URL works as expected.

>Are you able to catch any of the other WebBrowser events

Yes, I catch all other events that I was able to catch in IE6 in IE7.

Here is the code that I use to connect to the DWebBrowserEvents2:

hr = AtlAdvise(m_pWebBrowser2, (IDispatch*)this,__uuidof(DWebBrowserEvents2),&m_dwBrowserCookie);


I assume that javascript links are somehow handled differently in IE7.





Re: Internet Explorer Extension Development IE7: BeforeNavigate2 not called any more on javascript links

EricLaw-MSFT

"Navigation" to a Javascript URI is no longer treated as a navigation event.

Internally, the browser converts Javascript URIs to an embedded script block and then executes it.





Re: Internet Explorer Extension Development IE7: BeforeNavigate2 not called any more on javascript links

Viktor78

Thanks for the reply, Eric.

Would it be possible, regardsless whether it is internally treated as "navigation" or not, to call the BeforeNavigate2 event for javascript URIs again like in IE6

I and maybe other add-on developers relied on that functionality in IE6 and would definitely miss it in IE7.

Besides, it was a nice feature of the IE platform to have control over javascript execution by the cancel flag of the BeforeNavigate2 event.


p.s.
regarding this forum: I have experienced inconsistencies with the Windows Live Alerts notifications. I am not receiving an email notification for every reply that is made in one of my threads. And another suggestion for the forum: I would prefer a bigger default font size in messages.