views:

304

answers:

2

Is there a way to programmatically enable Javascript in Blackberry Browser?

In my application I have to open an URL in Blackberry browser but for that I need to first enable Javascript. I do not wish to use Browser Field as the content displayed in it doesn't look good. Any help in this regard will be highly appreciated.

+2  A: 

No, you can't override user settings on the native Browser. Your best bet is to gracefully degrade the webpage when it detects that Javascript is not available (if possible).

Marc Novakowski
Thank you very much for the response Marc. Can you elaborate a little more on "gracefully degrade the webpage". What i figured out by this that the it is the task of the web service to detect if javascript is enabled or not and accordingly make changes to the webpage. Right?? There's nothing that can be done in the application??
tek3
@tek3: The *best* way is to make sure the application works (possibly with limited features if needed) without javascript, but if that's not possible or reasonable, let the user know that they need to enable javascript. You can either use the `<noscript>` tag, or hide the message with javascript (so if it doesn't run, the message will still show up). Search for "graceful degradation" or "unobtrusive javascript" for a lot more information.
Matthew Crumley
+1  A: 

You can try it by:

RenderingOptions ro = _renderingSession.getRenderingOptions();
ro.setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.JAVASCRIPT_ENABLED, true); 
nhd