SourceForge Logo



PDQ Documentation

This is not complete documentation for BrowseX . What is described are some of the novel features of BrowseX . Namely Tcl scripts embedded in web pages, the macro processor and external program preprocessing. For examples of embedded Tcl programs, see Examples off the Download section. See here for the Expand documentation.
  1. PDQ Documentation

Tcl Embeds/Scripts

BrowseX  supports running Tcl code in a sandbox-like environment called Safe-Tcl. By default, Safe-Tcl disables all commands which could be potentially harmful. PDQ relaxes this security slightly to allow menus and toplevels. Menus enable mouse-grabs which Safe-Tcl views as a potential exposure due to the possibility of a denial of service attach (mouse grabbed but not let go). The risk of this should be minimal, but in any case it can be disbled in the preferences if concerned.

There are two ways of embedding client side Tcl into web pages.

  1. Scripts
    • Generated HTML
    • Event Handlers
  2. Embeds
    • Source Inlined
    • Source External
The first uses the script markup to include tcl inline and the second uses the embed markup to include an applet or application within the page. In either case, the Language=Tcl argument must be present to trigger PDQ Tcl support.


An embed can either inline the Tcl code between the embed and /embed or it can use a src= argument to fetch the code remotely. The first method is probably preferable since it results in faster time-to-load performance, but any sorrounding HTML may not render correctly.


Embed is typically used to run a Tk program, that is, a gui based application. Scripts on the other hand, are used to work in conjunction with or to generate HTML. The script model is therefore a bit more complicated. There are two distinct phases to Scripted pages. In the first, Tcl script commands are executed and any puts output is rendered as HTML. When the full page has been completely parsed PDQ will attempt to run the local proc After, if defined. The after proc can setup things like bindings on input fields for form validation. See form.html and use view source, for an example.

External Program Preprocessor

Lets say the only thing that stands in between you and web happiness is doubleclick ads inside web pages. What you may want is a way to disable just those images. External program preprocessing can handle this nicely.

  if [ x"$2" = "xtext/html" ]; then
    exec sed 's/'
The essential workings are, the program is passed 2 arguments: the url and the document type. Only text/* is handled. The page information is read from stdin and must be written back out to stdout. Unix pipelines are ideal for this kind of task.

Copyright © 1999-2001   Browsex Systems Inc