CETerm has the ability to inject HTML into a web page before it is rendered. This script demonstrates how the style attribute is injected into the page. We recommend using this technique to fix simple rendering issues. We do not recommend injecting larger streams of HTML into the current web page.
The sample script implements the OnDocumentDone handler which is triggered once a web page has completed loading but has not yet been rendered for presentation. It gets the DOM reference from the CETerm Browser automation object. It then adds the appropriate style to the DOM. The web page is then rendered with the newly added stryle attribute.
Please test with your full application to be sure the injected style does not cause troubles elsewhere.
function OnDocumentDone( session )
// Get the Document object associated with this web page
var d = CETerm.Session( session ).Browser.Document;
// Add style rule
var sheets = d.styleSheets;
if (sheets != null)
if (sheets.length == 0)
var ss = d.createElement( "style" );
d.appendChild( ss );
sheets.addRule( "tt","padding-left: 1px" );