Passing URL in address bar to added toolbar button in IE.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I wanted to add an application to a toolbar in Internet Explorer. I
followed the instructions given on MSDN. I follwed settings at
Web Development>IE development>Programming & resusing the browser>SDK
Documentation>Browser Extension>Overviews/Tutorials>Adding toolbar buttons.
The application is getting added in a toolbar. But I want to pass the
current URL in address bar as an argument to the application.
Can anyone please tell me how to do it?
 
Hi, here is a button script to open a new window

<HTML>

<SCRIPT LANGUAGE="JavaScript">

//New Window

//www.iecustomizer.com

var parentwin = external.menuArguments;

{parentwin.open
("","window","toolbar=yes,location=yes,status=yes,resizable=yes,favorites=ye
s,width=800,height=600");}

</SCRIPT>

</HTML>

The secret is 'external.menuArguments' which passes the 'window' object from
where the button was pressed. To get the current location of the window
object just find the 'location' property of the window

Currentloc = parentwin.location;

Alert(Currentloc);

A good example can be found in the default 500 Error handler for IE. (Just
enter a junk url in the address bar and use view source to look at the java
script and html). It uses the window object to extract where it was
navigating to, parse the url and then pass that information to a related
links search engine in the searh bar... Cool.

Heres a trick... Type the following into your browser address bar

javascript:alert(window.location);
 
Hi Rob,
Thanks for the reply. It was really helpful & addition to my knowledge.
But I meant a different thing. According to the way you've suggested, I
think the page I'm browsing must have the javascript code to do that. But I
want to do that for any URL & not a particular. I mean I can't add this
script to any web page like www.microsoft.com OR www.hotmail.com.
I'll state what I want to do again:
1. I want to add a button to the toolbar in IE. I could add the button
by modifying the windows registry at
HKEY_LOCAL_MACHINE>Software>Microsoft>Internet Explorer>Extensions as
suggested on MSDN. So this is the button on the IE toolbar & not on the HTML
page. I've set an application say 'C:\myapp.exe' for that button.
2. Now I want to pass the URL in our IE to that application like
"C:\myapp.exe www.hotmail.com".
This is what I want to do. :-)
 
Back
Top