开发者

How to work with hash based URL in BB OS5 browsers

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>jQuery Address API</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 CHA开发者_开发技巧NGE TEST</h1>

</body>

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 suggest me if i am missing something in my code Or an alternative way to change hash part in URL.

Any help will be appreciated. Thanks


Well hashhange must not implemented the bb os5 browser.

You should try a jQuery plugin that fix the issue with old browser or browser not implementing it : for example jQuery hashchange event

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜