RameshK

I have an IE explorer bar which makes use of a Right Click menu option. The right click menu option is implemented the usual way by creating a new key under HKCU\Software\Microsoft\Internet Explorer\MenuExt\<menu text> and this menu is pointing to a file in the local file system. This file is basically a VB Script file which parses the highlighted text passed down to it from the browser and uses that text as a query parameter to lauch another URL from the server (using external.menuArguments.navigate(url)). My Explorer Bar captures this navigation, stops it in the main browser and relaunches it using IWebBrowser2.Navigate so that the URL will show up inside my Explorer Bar rather than the main browser window.

Eventually this new URL will show up inside my Explorer Bar. This scheme of things works fine in IE6 but fails in IE7. In IE7, when I relaunch the URL using IWebBrowser2.Navigate, it seems to return an error and never seems to do the actual navigation. I tried setting the FEATURE_BLOCK_LMZ_SCRIPT to 1 as suggested in a couple of other threads, but didn't help. Anyone else facing this problem Why does the navigate method fail in IE7 Thanks




Re: Internet Explorer Extension Development IE7 and Right Click Menu

RameshK

I have some what of a clue as to what could cause this issue but don't have a solution. This issue could be because of the different zones/contexts used during the right click operation and the eventual launching of the page using Navigate method. Right click menu launches a local file pointed to by a registry key, which gets intercepted by my explorer bar and the explorer bar does the m_spBrowser->Navigate to launch a different page inside the explorer bar.

So, is trying to access different zones/contexts the issue here if it is, is there a solution I hope someone will answer soon. I am getting desperate. Thanks in advance.






Re: Internet Explorer Extension Development IE7 and Right Click Menu

IECUSTOMIZER

Hi Ramesh,

1. Firewall blocking of scripted context menus - Add beginning and ending comments to your context menu scripts.

<script language"vbscript">
<!---------
Dim win=external.menuArguments

etc...
----->
</script>

2. Passing the document location directly to a Side search bar.

See the search by google context menu which passes the selected text directly to a Google side search bar.

Basically it works by

var txt=Selecteddocumenttext;
var gurl='http://www.google.com/ie q=';
window.open(gurl + txt, '_search');

Hope this is what you are trying to achieve and find this of assistance.

Regards.






Re: Internet Explorer Extension Development IE7 and Right Click Menu

RameshK

Rob,


Thanks for the quick response. I tried your first suggestion. It didn't work.


I don't think I can use your second suggestion. How can I pass the selected text directly to the Explorer Bar This is the sequence. Please tell me where and how the selected text could directly be passed on to the explorer bar:

- text is selected in main browser
- right click on selected text and choose the menu option
- Choosing the menu option makes the main browser navigate to the script in the local file system
- The navigation is intercepted by the explorer bar
- Explorer bar looks for a specific parameter name in the URL to identify that the right click navigation
- Explorer bar stops the main browser navigation, parses the URL to get the selected text from the query parameter, reconstructs a new URL and does a Navigate2 on the Explorer Bar Browser (not the main browser).
- The site from the new URL ends up inside the Explorer bar (not a new Window)

Given the flow above flow, which works perfectly fine in IE6, how can I make it work in IE7

Thanks

K. Ramesh





Re: Internet Explorer Extension Development IE7 and Right Click Menu

IECUSTOMIZER

Hi K,

Here is the script from the Google search context menu.

<HTML>
<SCRIPT LANGUAGE="JavaScript" defer>
var parentwin = external.menuArguments;
var doc = parentwin.document;
var sel = doc.selection;
var rng = sel.createRange();
var str = new String(rng.text);

var nwin = new String ("http://www.google.com/ie q=" + str + "&num=20");

parentwin.open(nwin,'_search');

</SCRIPT>
</HTML>

The secret is the parentwin.open(nwin,'_search') line.

This will open the nwin url in the search pane. For IE7 users have to have 'Enable web sites to use the search pane' selected on the Advanced tab of Internet Options.

You could have your side bar as a html resource in a library(dll) and use the res:// protocol.

eg. res://googlesidebar.dll/google_EB.htm

but I have not tested this.... the res:// protocol does not work from link shortcuts in IE7 (does for 6). So I am guessing that this won't work in 7.

Oh also there is the problem of the popup blocker in IE7. I think the above script needs popup blocking turned off in order for the side bar to display without the information bar showing (or by adding the url to the white list)

Regards.






Re: Internet Explorer Extension Development IE7 and Right Click Menu

RameshK

Hi Rob,


Sorry, I am still not clear. I understand that parentwin.open will open the URL in a new window or a search bar depending on how you call it. But how is that going to help me in redirecting a new URL to my Explorer Bar

When you say "You could have your side bar as a html resource in a library(dll) and use the res:// protocol" what exactly do you mean You mean I could have the script executed by the context menu as a resource in the Explorer Bar DLL Even if I had the script as a resource, I still need to intercept the navigation from the script using the Invoke method in my Explorer Bar dll and then do a redirect to a different URL and that is the part that is not working. I hope I am making myself clear here. Thanks again for your help

K. Ramesh





Re: Internet Explorer Extension Development IE7 and Right Click Menu

RameshK

Some more findings on the issue:


In the sequence of events I have given above, the only way I can make the URL redirect to work and the final result to show up in my Explorer Bar is not to Cancel the main browser navigation of the original URL which was launched by the script. If I don't do the cancellation, the DOCUMENTCOMPLETE for that navigation gets called and then my redirect works just fine and the result shows up in the Explorer Bar. If I do cancel the main browser navigation, the DOCUMENTCOMPLETE never gets called, which is understandable, and my redirect never goes through. So, to reiterate the flow again:

- Right click menu option calls the VB Script, which does external.menuArguments.navigate(url)

- Call comes into Invoke method of my Explorer Bar and I trap it in BEFORENAVIGATE2

- I look for a specific paramter in the URL, and if found, do a mainBrowser->Stop() and a * (pDispParams->rgvarg[0].pboolVal) = VARIANT_TRUE;

- Immediately after that I call explorerBarBrowser->Navigate (bstrURL, &vFlags, &vTargetFrameName, NULL, NULL) . This call doesn't return a 0 if don't do the cancel in the previous step and returns a 2147024726. If I do a cancel in the previous step then this call returns a 0 and goes through.

Someone please help!!!





Re: Internet Explorer Extension Development IE7 and Right Click Menu

RameshK

So, no one has an answer Has no one else faced this problem I am still struggling ...