Creating a Custom Browser Toolbar Button to Return Webpage URL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • PK

    Creating a Custom Browser Toolbar Button to Return Webpage URL

    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.T oString" or "Request.Applic ationPath.ToStr ing"
    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.
  • mayayana

    #2
    Re: Creating a Custom Browser Toolbar Button to Return Webpage URL

    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.Applicati on Windows collection.
    The Windows collection is a collection of Shell Explorer windows
    but what is actually returned are IE objects. So ShellApp.Window s
    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.bo dy.innerhtml
    URLofPage = Win.LocationURL

    For the full code with button sample:


    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.Window s
    workaround.
    [color=blue]
    > 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.T oString" or "Request.Applic ationPath.ToStr ing"
    > 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:
    >[/color]

    rials/button.asp.


    Comment

    • Randy Birch

      #3
      Re: Creating a Custom Browser Toolbar Button to Return Webpage URL

      This isn't .net, but it will return the current URL from netscape or IE ...
      VBnet provides Intermediate and Advanced Win32 API code for VB developers. Comprehensive Code, FAQ, Developers Resources & News, alphabetical API/Type/Constant/Method Index, along with the largest Visual Basic-related links list on the net.


      --

      Randy Birch
      MVP Visual Basic

      Please respond only to the newsgroups so all can benefit.


      "PK" <earlpk@hotmail .com> wrote in message
      news:7ebaeea8.0 407230937.3a5f8 eee@posting.goo gle.com...
      : 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.T oString" or "Request.Applic ationPath.ToStr ing"
      : 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.

      Comment

      Working...