Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Posts: 99
Registered: ‎03-10-2009
My Device: Not Specified

how to automatically turn on the javascript support option ?

HI, 

 

I want the blackberry user can be redirect to a mobi version of the website automatically.

 

I can use the navigator.platform in Javascript supported by the browser on Blackberry to check the planform then redirect to the respective websites.

 

The thing is the default option for Javascript supporting is off, so that my javascript in the html file won't work.

 

How can I do to turn on the javascript supporting option programatically ? or any other ways to walk around this ?

 

Thanks,

Jerry 

Guru I
Posts: 19,020
Registered: ‎07-29-2008
My Device: Passport, Playbook, 9320BES
My Carrier: Bouygues _ SFR

Re: how to automatically turn on the javascript support option ?

the best way is to do the redirection on the server side. If you use PHP/Java/C# then there are many tutorials.

the idea is to get the user-agent of the browser, and do an http-redirect if it's a mobile device.

that way, you do what you want, whatever the javascript configuration on the handheld device is.



The search box on top-right of this page is your true friend, and the public Knowledge Base too:
Developer
Posts: 395
Registered: ‎12-18-2008
My Device: BlackBerry Torch 9800
My Carrier: AT&T

Re: how to automatically turn on the javascript support option ?

Keep in mind though that users can change the Browser Identification and your check to see if it's a BlackBerry using User-Agent won't work in that case. You will want to check the Profile header and parse the RDF URL to determine the device model.