Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Conversion to new format.

For security reasons, all BrightScript JavaScript objects are disabled by default. As a result, you will encounter DOM errors like those shown below if you do not enable first enable them (to view a console log of BrightScript/JavaScript events, navigate to the Diagnostic Web Server or use the JavaScript console).Image Removed

...

Follow the below steps to enable BrightScript JavaScript objects.

Enabling with BrightAuthor

Make sure that you are using BrightAuthor version 4.1 or later. Earlier versions do not have the code that enables BrightScript objects for JavaScript.

Also, ensure that the Enable external data box is checked within the HTML5 state that is displaying your page.Image Removed

...

Enabling with BrightScript

Include the brightsign_js_objects_enabled:true entry with the associative array that is passed during creation of the roHtmlWidget instance:

Example

Example
Code Block
title
r=createobject("rorectangle",0,0,1920,1080)
aa=createobject("roassociativearray")

aa.url="http://test-server/index.html"
aa.brightsign_js_objects_enabled=true

bb=createobject("roassociativearray")
bb.port=3000
aa.inspector_server=bb

h=createobject("rohtmlwidget",r,aa)
h.show()

The above method enables all BrightScript-JavaScript objects on an roHtmWidget instance. To enable only a subset of BrightScript-JavaScript objects, or to restrict the objects to certain URLs, use the AllowJavaScriptUrls() method on a roHtmlWidget instance. This method accepts an associative array that maps BrightScript-JavaScript classes to the URL(s) that are allowed to use them.

  • An all key indicates that all classes are authorized for the associated URL(s).

  • An asterisk "*" value indicates that all URLs are authorized for the associated BrightScript-JavaScript class.

  • A "local" value indicates that all local pages are authorized for the associated BrightScript-JavaScript class.

 

This call will enable all BrightScript-JavaScript classes for local pages and the BrightSign homepage.

Code Block
html.AllowJavaScriptUrls({ all: ["local", "http://www.brightsign.biz"]})