BBjHtmlView::setUserAgent

Description

In BBj 15.00 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 Navigator: userAgent property. The user agent string is read-only in browsers; this method is only available in the Java Swing GUI Chromium client.

Example

rem ' BBjHtmlView::setUserAgent

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
title$ = "BBjHtmlView::setUserAgent"
window! = sysgui!.addWindow(50,50,800,400,title$,$00090083$)
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.setCallback(window!.ON_RESIZE,"resize")
getUserAgent! = window!.addButton(1,25,25,150,25,"getUserAgent",$$)
getUserAgent!.setCallback(getUserAgent!.ON_BUTTON_PUSH,"getUserAgent")
setUserAgent! = window!.addButton(2,25,75,150,25,"setUserAgent",$$)
setUserAgent!.setCallback(setUserAgent!.ON_BUTTON_PUSH,"setUserAgent")
userAgent! = window!.addEditBox(101,200,75,575,25,"",$$)
htmlview! = window!.addHtmlView(102,25,125,750,250,"",$$)
gosub display

process_events

eoj:
  release

display:
  js$ = "navigator.userAgent"
  userAgent$ = str(htmlview!.executeScript(js$))
  text$ = js$ + " = " + userAgent$
  htmlview!.setText(text$)
return

resize:
  event! = sysgui!.getLastEvent()
  htmlview!.setSize(event!.getWidth()-50,event!.getHeight()-150)
  userAgent!.setSize(event!.getWidth()-225,userAgent!.getHeight())
return

getUserAgent:
  userAgent$ = htmlview!.getUserAgent()
  userAgent!.setText(userAgent$)
return

setUserAgent:
  htmlview!.setText("")
  htmlview!.setUserAgent(userAgent!.getText())
  gosub display
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

BBjHtmlView::getUserAgent

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