BrowseX
SourceForge Logo
BrowseX
 Home
 News
 Download
 Features
 Demos
 
 API
 SQLite
 TML
 Dballoc
 Javascript
 Mailer
 Address
 Mimetypes
 Portal
 DynDNS
 Talk
 ZipView
 TDB
 Packaging
 Passman
 Thin
 
 Press
 Docs
 Bugs
 FAQ
 Pros
 Why
 License
 Contacts

Search
Links
 Scriptics
 Tkhtml
 Postgres
 OpenSSL
 Img
 Baremetal

Contact
peter@browsex.com

The Tcl Javascript Widget

BrowseX  includes a modified version of the NGS javascript compiler and the jstcl widget has been created to give access from Tcl. A DOM or Document Object Model has been added to the Tkhtml widget. The DOM is what ties Javascript together with the Browser. With BrowseX  this is done entirely at the Tcl level, and the remaining task is to complete the required Tcl in order to achieve this. Currently, the focus has been to provide enough of the glue to interface Javascript to support Forms handling.

Because the DOM has not been fully connected to the JS, most javascript will probably not yet work. Normally, javascript errors are not shown. To see them, try adding the following to you browsex.cnf: javas:debug 1

Performance is quite acceptable, with little runtime overhead. Memory consumption does increase when using javascript, usually by 100-500K per view containing JS, so you may wish leave it disabled if not required.

Side Note Since NGS byte compiles Javascript, it is possible to do some funky things, like embedding precompiled Javascript inside web pages. BrowseX  supports this with a precompiled attribute and base64 encoding. Following is a simple example.

var x=99; 
document.write("<B>Here is my compiled Test</B>\n");

Compile this (Hint: the BrowseX  Editor has a JS Compile option in the Opts menu) and put it into a .html file, thus:
<script language=Javascript precompiled>
wAFKUwAAAAQAAAAAAAAAHhIAAABjAxQAAAAABAkAAAABDxMAAAACNQAAAAMGAwAAAAEAAAA5
CngABAAAACA8Qj5IZXJlIGlzIG15IGNvbXBpbGVkIFRlc3Q8L0I+Cgpkb2N1bWVudAAKd3Jp
dGUAAAAAAgAAABAAAAABLmdsb2JhbAAAAAAAAAAAAwAAABoBAAAADFN0cmluZ1N0cmVhbQIA
AAARAAAAAQ==
</script>

You can disable this by adding to you browsex.cnf: javas:precompile 0.
It is possible to implement extremely sophisticated applications in JS. Proof: the NGS compiler is itself written in JS.

Known Incompatibilities

    Copyright © 1999-2001   Browsex Systems Inc   http://BrowseX.com