Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TWebBrowser - trap invalid URL

Status
Not open for further replies.

AP81

Programmer
Apr 11, 2003
740
AU
Hi,

Using a TWebBrowser control, it is possible to trap if a URL is invalid? It doesn't look as though a TWebBrowser component has this capability.

For example:
Code:
WebBrowser1.Navigate('[URL unfurl="true"]http://asdfasdfsadf');[/URL] //I need to trap that this failed.

Thanks.

_______________________________
There's no place like 127.0.0.1
_______________________________
 
I think I have code at home that addressed this. I'll look. In the meantime, have a look at OnNavigateComplete2 event (TWebBrowser) and the accompanying example in Help. Getting deep, but also look at GetStatusCode method (TWebResponse).

In procedure Navigate2(var URL: OleVariant; var Flags: OleVariant); overload;
You can assign "navAllowAutosearch" to Flags:
navAllowAutosearch (16) If the navigation fails, the Web browser attempts to navigate common root domains (.com, .edu, and so on). If this still fails, the URL is passed to a search engine.
There's no place like LocalHost? Just kidding, good one!

Roo
Delphi Rules!
 
Thanks Roo,

using idHTTP I found that I can call idHTTP.GET and dump the URL into a file stream. If that fails,then I know whether it is a valid URL.

_______________________________
There's no place like 127.0.0.1
_______________________________
 
Kind of round-about, but if it works, what the heck!

Roo
Delphi Rules!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top