BBjHtmlView::injectUrl

Description

In BBj 17.0 and higher, this method injects the specified JavaScript URL into the HTML document  BBjHtmlView control, making it available for subsequent use by BBjHtmlView::executeScript.

Syntax

Return Value

Method

void

injectUrl(string url)

void

injectUrl(string url, boolean top)

Parameters

Return Value

Method

url

URL containing JavaScript  to be injected into the HTML document of  this BBjHtmlView.

top

Boolean value specifying whether this URL is to be injected into the top level window of the page.

Return Value

None.

Remarks

None.

Example

rem ' BBjHtmlView::injectURL
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(50,50,300,200,"injectUrl",$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
js$ = "https://www.poweredbybbj.com/files/scripts/hello.js"
html$ = "<html>"
html$ = html$+"<body>"
html$ = html$+"<input type='button' onclick='hello()' value='Click Me!' style='margin:15px;'>"
rem html$ = html$+"<script src="+js$+"></script>"
html$ = html$+"</body></html>"
print stbl("!OPTIONS","JAVAFX_HTMLVIEW=true")
htmlview! = window!.addHtmlView(101,25,25,250,150,html$)
htmlview!.setCallback(htmlview!.ON_PAGE_LOADED,"inject")
process_events
eoj:
release
inject:
htmlview!.injectUrl(js$,1)
htmlview!.clearCallback(htmlview!.ON_PAGE_LOADED)
return

Contents of https://www.poweredbybbj.com/files/scripts/hello.js

function hello() {
alert("Hello from an external JavaScript file")
}

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.