从地址栏中搜索网络 [英] Search the web from the address bar

查看:66
本文介绍了从地址栏中搜索网络的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的WebBrowser上,我当然有一个地址栏,但我只能在地址栏中搜索url,例如 facebook.com等。我希望我的地址字段能够像搜索引擎一样工作,因此当我输入类似www.facebook.com时,我将转到facebook.com,当我进行类似facebook的搜索时,如果没有www或.com或我想要的东西地址栏,将我重定向到 https://www.google.se/?gws_rd= ssl#q = facebook 如果您明白我的意思。

on my WebBrowser I have a address bar of course, but I can only search urls in the address bar, like "facebook.com" and something. I want my address field to be able to work like a search engine to, so when I type like www.facebook.com I will go to facebook.com and when I search like facebook, without www or .com or something I want my address bar to redirect me to https://www.google.se/?gws_rd=ssl#q=facebook if you know what I mean.

推荐答案

您可以尝试使用以下功能::

You can try using this function::

Private Function CheckURL(ByVal UrlText As String)
    Dim URL As New Uri(UrlText)
    Dim Req As System.Net.WebRequest
    Req = System.Net.WebRequest.Create(URL)
    Dim Resp As System.Net.WebResponse

    Try
        Resp = Req.GetResponse()
        Resp.Close()
        Req = Nothing
        Return True
    Catch ex As Exception
        Req = Nothing
        Return False
    End Try
End Function

这篇关于从地址栏中搜索网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆