< Back

Document Subject: How to set the user's location's default Browser
Hint Short Cut: Add this to your code & documentation to help you find this page.
http://#SetBrowser or http://A555F9/nn.nsf/ByAlias/SetBrowser

At a customer's site the default setting for notes was to launch any urls using the "Internet Explorer" with Notes option. Most of our systems needed to use Internet Explorer so I was given the task to write code to fix this bad setting on the fly. This setting is in the user's current location document. Updating it is trivial, refreshing the location data was a bit trickier. This is the entire code I used.




To manually change this setting, the user clicks on "Edit Current" at the bottom right hand corner of the notes client screen where it usually says "Network" or "Office". The user then changes tabs to "Internet Browser" and changes the value, and saves and closes the document.

 

Programmatically this seems straight forward as the location documents are stored in the user's personal name and address book stored locally at names.nsf.

 

This is all trivial, but the tricky bit was to refresh the locaiton changes, I found I had to do this by changing location and then changing back. This is uses a method not available to Release 4, so this is catered for by telling them to restart Notes and upgrade!

 

 Dim uiw As New notesuiworkspace
Dim db As notesdatabase
Set db = uiw.currentdatabase.database

'check browser is set to ie
Dim session As New notessession
If Instr(session.GetEnvironmentstring("Location", True),",") > 0 Then
 location = Left( session.GetEnvironmentstring("Location", True),              Instr(session.GetEnvironmentstring("Location", True),",")-1   )
Else
 location = "-Not found !-"    
End If

Dim answer As Integer
answer=0
Dim persAddrBk As New notesdatabase("", "names.nsf")
If persAddrBk.isopen And location<> "-Not found!-" Then
 Set vloc = persAddrBk.getview("Locations")
 Set locdoc =    vloc.getdocumentbykey(  location )
 If  Cstr(locdoc.Webretriever(0))<>"2" Then    
  answer% = Messagebox("You do not have Internet Explorer set as your Notes default browser. Do you want it set now and continue?", 20, _
  "Continue?")
  If answer%=6  Then '    yes
   locdoc.Webretriever="2"  
   Call locdoc.save(False,False)
   
   If Instr(session.Notesversion, "Release 4") Then
    Messagebox ("Restart notes to implement this change you Release 4 person!")
   Else
   'notes r5 only: change locations to refresh the changes
   'get first location from loc view
    Dim locdoc2 As notesdocument
    Set locdoc2 = vloc.getfirstdocument()
    Do Until locdoc2.name(0) <> location
     Set locdoc2 = vloc.getnextdocument(locdoc2)
     If locdoc2 Is Nothing Then Exit Do
    Loop
   
    If locdoc2 Is Nothing Then
     Msgbox "Restart notes to implement this change - you only have one location."
    Else
     Call uiw.SetCurrentLocation( locdoc2.name(0) )
     Call uiw.SetCurrentLocation( location )
     
    End If
   
   End If' notes version
   
  Else
   Print "User chose not to continue."
   Exit Sub
  End If
 End If
End If
 
Call uiw.urlopen("http://www.adfos.com";)