BUI logoBBjWebManager::injectLinkUrl

Description

In BBj 22.03 and higher, this method injects the specified link URL into the web page.

Note:

In BBj 22.03 and higher, BBjWebManager is an alias for BBjBuiManager.

Syntax

Return Value Method

void

injectLinkUrl(string url)

void injectLinkUrl(string url, boolean top)
void injectLinkUrl(string url, boolean top, String attributes)

void

injectLinkUrl(string url, boolean top, HashMap attributes)

Parameters

Parameter Description

url

A link URL to be injected into this web page as a link element.

top A boolean value specifying whether this link is to be injected into the head (true) or body (false) section.

attributes

A set of attributes to be added to the link element. Attributes can be specified either as a string in the format "attr=value,attr=value" or as a HashMap containing key/value pairs.

Return Value

None.

Example

rem ' BBjWebManager::injectLinkUrl

url$ = "https://en.wikipedia.org/wiki/Favicon#/media/File:Apple_logo_black.svg"
url$ = "http://www.basis.cloud/sites/all/themes/basis/logo.png"
top = 1
attributes$ = "rel=icon,type=image/png,id=xyzzy"

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()

title$ = "BBjWebManager::injectLinkUrl"
window! = sysgui!.addWindow(25,25,600,225,title$,$00090083$)
window!.setCallback(window!.ON_RESIZE,"resize")
window!.setCallback(window!.ON_CLOSE,"eoj")

window!.addStaticText(101,5,25,90,25,"URL:",$8000$)
url! = window!.addEditBox(102,100,25,475,25,url$,$$)

top! = window!.addCheckBox(103,100,75,475,25,"Top",$$)
top!.setSelected(top)

window!.addStaticText(104,5,125,90,25,"Attributes:",$8000$)
attributes! = window!.addEditBox(105,100,125,475,25,attributes$,$$)

injectLinkUrl! = window!.addButton(1,100,175,475,25,"injectLinkUrl",$$)
injectLinkUrl!.setCallback(injectLinkUrl!.ON_BUTTON_PUSH,"injectLinkUrl")

browser! = bbjapi().getWebManager(err=oops)
browser!.setCallback(browser!.ON_LINK_LOADED,"loaded")
browser!.setCallback(browser!.ON_LINK_FAILED,"failed")

process_events

oops:
i = msgbox("This functionality is only supported in browser environments.")

eoj:
release

resize:
    event! = sysgui!.getLastEvent()
    width = event!.getWidth()
    height = event!.getHeight()
    url!.setSize(width-125,25)
    top!.setSize(width-125,25)
    attributes!.setSize(width-125,25)
    injectLinkUrl!.setSize(width-125,25)
return

injectLinkUrl:
    url$ = url!.getText()
    top = top!.isSelected()
    attributes$ = attributes!.getText()
    browser!.injectLinkUrl(url$, top, attributes$)
return

loaded:
    event! = sysgui!.getLastEvent()
    msg$ = date(0:"%Hz:%mz:%sz.%tz %p ")+event!.getEventName()+" url="+str(event!.getUrl())
    i = msgbox(msg$)
return

failed:
    event! = sysgui!.getLastEvent()
    msg$ = date(0:"%Hz:%mz:%sz.%tz %p ")+event!.getEventName()+" url="+str(event!.getUrl())
    i = msgbox(msg$)
return

See Also

BBjAPI

BBjSysGui

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