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
New Developer
Posts: 43
Registered: ‎07-29-2008
My Device: Not Specified

Re: bold 9000 and javascript

Hello tschmit,

 

it would be interesting to know how you have hacked jQuery 1.2.6.

Highlighted
New Developer
Posts: 6
Registered: ‎12-29-2008
My Device: Not Specified

Re: bold 9000 and javascript

hello,

 

well, it is quite easy

- download jquery-1.2.6.js (the normal version)

- edit and search var userAgent = navigator.userAgent.toLowerCase();

- replace by
var userAgent = navigator.userAgent.toLowerCase();if(userAgent.match(/blackberry.*/)){userAgent='mozilla/5.0 (windows; u; windows nt 5.1; fr; rv:1.9.0.5) gecko/2008120122 firefox/3.0.5';}

- save as jquery.bb.js

- minimize with something like 

<?php
    $f = file('jquery.bb.js');
    $d = array();
    foreach ($f as $l ) {
        if ( !(($i = strpos($l, '//')) === false ) )
            $l = substr($l, 0, $i);
        $l = trim($l);
        if ( $l != '' ) {
            $d[] = $l;
        }
    }
    file_put_contents('jquery.bb.min.js', implode("\r", $d));
?>

- insert in your html pages by <script type="text/javascript" src="js/jquery.bb.min.js"></script>

Developer
Posts: 107
Registered: ‎09-25-2008
My Device: Not Specified

Re: bold 9000 and javascript

I did what you suggested, and it works for me.

http://staktrace.com/pub/jquery/jquery.html - this uses the full jquery with your userAgent hack
http://staktrace.com/pub/jquery/jquery.min.html - this uses the minified jquery with the userAgent hack

Both files display the 'PASS' message for me when I load it in the browser with javascript setting on and browser identification set to blackberry. I'm using a 4.6.1 build, so maybe it was something that was fixed recently?