Custom Toolbar to Access URL of current page.

P

PK

I'm trying to create a custom browser toolbar button that will do a
few things. One that I'm trying to do at the moment is just simply
return the URL of whatever page the user is visiting.

I wanted to create a Win32 application using VB.NET. If there is a
better way of doing this please let me know. I assume there needs to
be some sort of client side code. I was originally leaning towards
using "Request.Path.ToString" or "Request.ApplicationPath.ToString"
but these require server based execution.

For the time being, I'm creating a simple VB.NET Win32 application
with 1 button. The onclick of which should be able to access the URL
of the existing page. However, since the application isn't part of any
browser yet, I'm unsure of how to access information about the page.

Any ideas on the code to use and how to implement this? I'm looking
for some code examples and direction on how to go about this (ie.
create an executable from the win32 application, etc). Maybe there is
some javaScript that can be used. I will eventually be creating a
toolbar similar to that explained in the following link:
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/ext/tutorials/button.asp.
 
R

Robert Aldwinckle

Maybe there is some javaScript that can be used.

There is. If you have IE5 Web Accessories installed,
right-click on any page and use Copy Location.
If you trace back the implementation of that command you will find
a script in the %windir%\Web directory called GrabURL.htm

GrabURL.htm is one of the utilities from that package which needs
some modification to work under IE6. Jim Byrd occasionally posts
a complete list of such mods. Search Google Groups for those:

graburl author:byrd group:microsoft.*.ie6.browser


For your convenience here is the (corrected) source:

<example>
D:\WINDOWS\Web>type graburl.htm
<HTML>

<input type="edit" name="location" value="">

<SCRIPT LANGUAGE="JavaScript" defer>

var win = external.menuArguments;
document.all.location.value = win.location.href;
document.all.location.select();
document.execCommand("Copy");

</SCRIPT>
</HTML>
</example>


HTH

Robert Aldwinckle
 

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