472,102 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,102 software developers and data experts.

Creating a Custom Browser Toolbar Button to Return Webpage URL

PK
Hello,
I am looking for help on the following. 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/de...als/button.asp.
Jul 17 '05 #1
2 9590
This isn't a .Net group. I have no idea how that might play
into what you want to do. I also don't get what you mean by
"some sort of client side code". If you want to have a toolbar
button isn't that an entirely client-side operation?

I don't know whether this will help but I have a VBScript
package that does what you want. It's an ad-blocking utility
that gets the IMG SRC URLs of the current webpage and
offers to add any selected URLs to the HOSTS file. The IE 5,6
version does it by running the script from a toolbar button.
(I don't know of any way to add a button to IE4, Mozilla or Opera.)

The script finds the open IE window that the click came from
by iterating through the Shell.Application Windows collection.
The Windows collection is a collection of Shell Explorer windows
but what is actually returned are IE objects. So ShellApp.Windows
includes all folders and IE instances that are open. Once you've got
that you can use the IE DOM:

'-- Where Win is a Windows collection item:
HTMLofPage = Win.Document.body.innerhtml
URLofPage = Win.LocationURL

For the full code with button sample:
http://www.jsware.net/jsware/zips/hosts.zip

If you make a true browser extension for your button it gets an
IE reference indirectly passed to it. I don't know whether .Net can
build browser extensions. VB can do it through use of a Typelib that
defines the interfaces used.
In the case of just creating a button your
only option, as far as I know, is to open the file of your choice
when the button is clicked. I don't know of a way to get any kind
of pointer to the IE instance with that. (A button gets created through
the Registry Extensions key but it doesn't necessarily have to be
connected with a browser extension.) Hence the ShellApp.Windows
workaround.
I am looking for help on the following. 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/de...owser/ext/tuto
rials/button.asp.
Jul 17 '05 #2
This isn't .net, but it will return the current URL from netscape or IE ...
http://vbnet.mvps.org/code/internet/browserurl.htm

--

Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"PK" <ea****@hotmail.com> wrote in message
news:7e**************************@posting.google.c om...
: Hello,
: I am looking for help on the following. 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/de...als/button.asp.

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by jcnews | last post: by
3 posts views Thread by Shane | last post: by
2 posts views Thread by Alvo von Cossel I | last post: by
6 posts views Thread by G Dean Blake | last post: by
27 posts views Thread by Wayne | last post: by
15 posts views Thread by tshad | last post: by
7 posts views Thread by Marcolino | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.