Results 1 to 7 of 7

Thread: How can I read what is being searched in a web browser, and return it to a MessageBox

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2018
    Posts
    51

    Question How can I read what is being searched in a web browser, and return it to a MessageBox

    I have an application which I'm using to practice with, which will re-direct traffic from a certain website to a different website.

    For example
    1.

    User opens a web-browser and types in a link like "www.youtube.com".

    2.

    The user presses 'enter' and they're forwarded to www.youtube.com.
    Now, what if I don't want to go to this website, and I want to redirect the search to a different domain? How would I do this? Would it look something like this?

    Code:
    Dim website As "www.youtube.com"
    If website.IsSearched = True Then
    MesssageBox.Show("This site is whitelisted.")
    I know this code will NOT work, but, it's a brief example of what I'm trying to achieve.

    Any help or references to projects would be great.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: How can I read what is being searched in a web browser, and return it to a Messag

    Are you talking about a Windows Forms WebBrowser control? If so then I think what you're looking for is the Navigating event. You can test e.Url, set e.Cancel to True to cancel the current navigation and then call Navigate and pass an alternative URL if desired.

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2018
    Posts
    51

    Re: How can I read what is being searched in a web browser, and return it to a Messag

    No.

    I'm looking to read what the user types into the browser, and if the user types in a certain link, the redirect event will happen. I'm not using WebBrowser.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: How can I read what is being searched in a web browser, and return it to a Messag

    So you're talking about any web browser application, e.g. IE, Chrome, Firefox of Edge? That's probably relevant information that you should include in your OP. Clarity is never bad.

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2018
    Posts
    51

    Re: How can I read what is being searched in a web browser, and return it to a Messag

    Correct.

  6. #6
    Fanatic Member kpmc's Avatar
    Join Date
    Sep 2017
    Posts
    1,012

    Re: How can I read what is being searched in a web browser, and return it to a Messag

    Sounds like he wants a keylogger

  7. #7
    Frenzied Member
    Join Date
    Oct 2012
    Location
    Tampa, FL
    Posts
    1,187

    Re: How can I read what is being searched in a web browser, and return it to a Messag

    The short story is you cannot do what you are asking. You would be better off managing the local HOSTS file than reinventing the wheel.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width