Results 1 to 24 of 24

Thread: Shell to a new browser to open a URL

Threaded View

  1. #5
    Junior Member
    Join Date
    Apr 2012
    Posts
    20

    Re: Shell to a new browser to open a URL

    Quote Originally Posted by Emcrank View Post
    Code:
    Process.Start("explorer.exe", "www.google.com")
    Works fine for me
    Just a nice little sub, some people may like: (but its not as good as a 12" pizza sub!)

    vb.net Code:
    1. Private Sub NavigateWebURL(ByVal URL As String, Optional browser As String = "default")
    2.  
    3.     If Not (browser = "default") Then
    4.         Try
    5.             '// try set browser if there was an error (browser not installed)
    6.             Process.Start(browser, URL)
    7.         Catch ex As Exception
    8.             '// use default browser
    9.             Process.Start(URL)
    10.         End Try
    11.  
    12.     Else
    13.         '// use default browser
    14.         Process.Start(URL)
    15.  
    16.     End If
    17.  
    18. End Sub

    ---
    Call: will open www.google.com in Firefox if it is installed on that PC.

    vb.net Code:
    1. NavigateWebURL("http://www.google.com", "Firefox") '// safari Firefox chrome etc

    ---
    Call: will open www.google.com in default browser.

    vb.net Code:
    1. NavigateWebURL("http://www.google.com", "default")

    OR

    vb.net Code:
    1. NavigateWebURL("http://www.google.com")

    The post: http://stackoverflow.com/questions/6...wser/#15192260
    Last edited by o3xa; Mar 3rd, 2013 at 07:06 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
  •  



Click Here to Expand Forum to Full Width