Enable JavaScript when using the BrowserContent class

by Retired on ‎02-17-2010 10:41 AM (2,136 Views)


This article applies to the following:

  • BlackBerry® smartphones based on Java® technology
  • BlackBerry® Device Software 4.0 and later


When displaying Hypertext Markup Language (HTML) using the BrowserContent class, for example, in the BrowserFieldDemo sample distributed in BlackBerry Java Development Environment (BlackBerry JDE) 4.1 or later, JavaScript® is not enabled by default. To enable it, set the JavaScript property in the rendering session using the following code:

renderingSession = RenderingSession.getNewInstance();

// enable javascript
_renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.JAVASCRIPT_ENABLED, true);