BrightScript objects for JavaScript are not working

Last Updated: May 2, 2016

If you are using BrightScript objects for JavaScript, you may run into DOM errors like those shown in the following screenshot. To view a console log of BrightScript/JavaScript events, navigate to the Diagnostic Web Server or use the JavaScript console.

DOM_Exception_--_Console_Output.png

Follow the below steps if you are encountering DOM errors.

If using BrightAuthor to display HTML

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.

If displaying HTML using BrightScript

Call the AllowJavaScriptUrls() method on the roHtmlWidget instance you are using to display the page. This method accepts an associative array that maps JavaScript BrightScript 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 class.
  • A "local" value indicates that all local pages are authorized for the associated BrightScript class. 

Example: The following will enable all BrightScript classes for all URLs.

html.AllowJavaScriptUrls({ all: "*" })

Example: The following will enable all BrightScript classes for local pages and the BrightSign homepage.

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

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Can't find what looking for? Try to
Powered by Zendesk