BBjHtmlView::setUserAgent

Description

In BBj 15.0 and higher, this method sets the user agent string for this BBjHtmlView control.

Syntax

Return Value

Method

void

setUserAgent(string userAgent)

Parameters

Variable

Description

string

The user agent string to be used for the BBjHtmlView control.

Return Value

None.

Remarks

For more information about the user agent string, go to useragentstring.com.

Example

rem ' BBjHtmlView::getUserAgent
url$ = "http://www.useragentstring.com/"
client = 0
if info(3,6)<>"5" then
   client = msgbox("BBjHtmlView Client",7+32+512,"BBjHtmlView","Swing","JavaFX","Chromium")
   switch client
      case 1; rem ' Swing
         print stbl("!OPTIONS","CHROMIUM_HTMLVIEW=FALSE",ERR=*NEXT)
         print stbl("!OPTIONS","JAVAFX_HTMLVIEW=FALSE",ERR=*NEXT)
         break
      case 2; rem ' JavaFX
         print stbl("!OPTIONS","CHROMIUM_HTMLVIEW=FALSE",ERR=*NEXT)
         print stbl("!OPTIONS","JAVAFX_HTMLVIEW=TRUE",ERR=*NEXT)
         break
      case 3; rem ' Chromium
         print stbl("!OPTIONS","CHROMIUM_HTMLVIEW=TRUE",ERR=*NEXT)
         print stbl("!OPTIONS","JAVAFX_HTMLVIEW=TRUE",ERR=*NEXT)
         break
   swend
endif
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(50,50,800,650,"htmlview "+url$,$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
getUserAgent! = window!.addButton(1,25,25,100,25,"getUserAgent",$$)
getUserAgent!.setCallback(getUserAgent!.ON_BUTTON_PUSH,"getUserAgent")
text! = window!.addEditBox(100,150,25,625,25,"",$0200$)
setUserAgent! = window!.addButton(2,25,75,100,25,"setUserAgent",$$)
setUserAgent!.setCallback(setUserAgent!.ON_BUTTON_PUSH,"setUserAgent")
edit! = window!.addEditBox(101,150,75,625,25,"",$$)
htmlview! = window!.addHtmlView(102,25,125,750,500,"",$$)
htmlview!.setUrl(url$)
process_events
eoj:
  release
getUserAgent:
  useragent$ = htmlview!.getUserAgent()
  text!.setText(useragent$)
return
setUserAgent:
  htmlview!.setText("")
  htmlview!.setUserAgent(edit!.getText())
  htmlview!.setUrl(url$)
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.



______________________________________________________________________________________

Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.