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
Highlighted
Visitor
Posts: 1
Registered: ‎05-04-2011
My Device: OS5 web browser
My Carrier: simulator

How to work with hash based URL in BB OS5 browsers.

Hi,

I am developing a web app which dynamically alters the hash location in the URL according to the app requirements.

I am using window.location.hash to alter this. It work fine across all the browser. For any hashchange in address i have used hashchange event which does the required action after detecting hashchange.

But these events are not working in Blackberry OS5 browsers. For testing i am using BB OS5 9700 simulator's browser. Below i have added sample code.

<html>
<head>
   
<title> Address</title>
   
<meta http-equiv="content-type" content="text/html; charset=utf-8">
   
<script type="text/javascript" src="jquery-1.5.min.js"></script>
   
<script type="text/javascript">
      $
(document).ready(function() {
          window
.location.hash=("#issue1");

          $
(window).bind('hashchange', function() {
              alert
('firedonchange');
         
});

     
});

   
</script>
</head>
<body>
       
<h1> HASH ADDRESS CHANGE TEST</h1>

</body>
</html>

In the above sample code if i have given url http://test.stk.net then it will be changed to http://test.stk.net/#issue1 and it will alert the given value on hashchange. It is working fine for browsers e.g Mozilla, chrome, safari, mobile safari, android native browser, But in BB OS5 browsers (e.g BB 9700 simulator's browser) hash change in address is not working.

Can anyone tell me are these  javascripts  are supported by BBOS5  browsers Or an alternative way to change hash part in URL in BB browser using javascript.

 

Any help will be appreciated. Thanks