DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    May 2007

    Need help blocking web sites with webbrowser control

    I am writing a VB6 program for my grandchildren where the click of a command button displays a web site in a webbrowser control. Everything is working well, but I want to block any attempt to link to other web sites. For example, if the child clicks the button to go to a web site with childrens games, it would be OK to click a link WITHIN that web site, but not OK to click on a link that would send the browser to, say, an advertisement leading to an outside web site. I tried the BeforeNavigate events, but they seem to fire too late, because the new website in the control is half displayed before I get a chance to do a webbrowser.stop; and if I try to do a webbrowser.goback, the program goes into a nasty loop. Any suggestions would be appreciated. Thanks, Ron E.

  2. #2
    Join Date
    Nov 2003
    Portland, OR
    I don't know if it's possible to prevent a WebBrowser control from following a hyperlink. Instead, you might try using an Internet Transfer Control to download the HTML source of the page you want to display, then go through the HTML programmatically and remove any links to sites outside the page's domain. Finally, display the sanitized HTML in the WebBrowser control.
    Phil Weber

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

Similar Threads

  1. Web User Control and javascript
    By s in forum ASP.NET
    Replies: 0
    Last Post: 03-26-2003, 02:17 PM
  2. Why Web Services are Important
    By Constance J. Petersen in forum .NET
    Replies: 13
    Last Post: 08-28-2002, 10:06 PM
  3. Replies: 1
    Last Post: 02-05-2002, 12:53 AM
  4. WebBrowser control...
    By FLD in forum Enterprise
    Replies: 2
    Last Post: 11-20-2000, 11:34 AM
  5. Using the web browser control from vb 6
    By Rick Burden in forum Enterprise
    Replies: 0
    Last Post: 07-22-2000, 10:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.