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
Regular Contributor
Posts: 58
Registered: ‎01-19-2011
My Device: 9800
My Carrier: vodafone

History.back() / hardware back / navigation problem

 

My latest problem in the mysterious webworks platform  is something as simple as navigation. On some Torch 9800 the hardware back button does not work, other do not seem to have a problem. So, my workaround was to capture the hardware button and do a History.back() instead. That worked fine on 9800 Torch Simulator but when installed on a real 9800 Torch the capture didnt happen.

 

function captureBackButton() {

            blackberry.system.event.onHardwareKey(blackberry.system.event.KEY_BACK,

function() {

                history.back();  

              return false;

            });

        }

 

I made something that actually worked on all Torch 9800, however that kills all other phones I tried it on due to them saving all the pages and not closing them making the hardware backbutton go through ALL the pages one by one

 

function captureBackButton() {

            blackberry.system.event.onHardwareKey(blackberry.system.event.KEY_BACK,

function() {

               

              location.href = 'entry.htm';  

              return false;

            });

        }

 

 

 

Could RIM pls provide a best practice for something as simple as navigation between 3 pages?

 

Regular Contributor
Posts: 58
Registered: ‎01-19-2011
My Device: 9800
My Carrier: vodafone

Re: History.back() / hardware back / navigation problem

I am running on webworks 2.1.1.38
Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: History.back() / hardware back / navigation problem

Hi genvej,

 

Is true that the back button will not trap # anchor links, but if its not trapping page changes this is likely a setting in your config.xml.

 

The original code you posted with History.back should work fine and simulate what you want. I'm confused as to what the issue is since your complaint seems to be related to the desired behaviour.



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Regular Contributor
Posts: 58
Registered: ‎01-19-2011
My Device: 9800
My Carrier: vodafone

Re: History.back() / hardware back / navigation problem

My problem is that not one solution fits all devices.

 

I have 2 Torch 9800. On the first one history.back works fine. The other one (which for some strange reason does not have the hardware back issue) the history.back will cause that navigation is not possible.

 

I have 9780 os6 device that will not work with history.back either.

 

The best thing I have experienced is the location.href in the trapped hardware back event, however that will not work on the Torch that does not have the hardware back issue.

 

I can understand you are confused, so am I. I mean if webworks does not support the most basic funtionality in navigation, this is going to be hard

 

I need a navigation solution that works on all devices in OS5 and OS6.

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: History.back() / hardware back / navigation problem

From what I remember there's an issue with BrowserField (which is used in WebWorks) where if you change the location.href to change the url of the page, the history list of the BrowserField and what is actually in the WebKit engine get out of sync so the back navigation gets a little wierded out.

 

I'll talk to Jeff on Monday and bring him up to speed.  If I remember correctly someone had a work around

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: History.back() / hardware back / navigation problem

Hi genvej,

 

Lets try and find a solution that'll work for ewverything.

Can you please provide me with the full dot revision OS system versions ie 6.0.0.246 for the three devices you mentioned?

 

Also, do you think you can create a very simple set of pages that replicates the problem?

 

Worst case we'll have to check for the OS in the javascript but hopefully one day this can be integrated into the framework



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Regular Contributor
Posts: 58
Registered: ‎01-19-2011
My Device: 9800
My Carrier: vodafone

Re: History.back() / hardware back / navigation problem

[ Edited ]

Thx to Neil and Jeff. You are heroes around this forum.

 

Torch OS 6 Bundle 695 does not have the exit problem when using the hardware back button. But when using history.back() in a trapping method nothing happens and there is no way to navigate to prior pages.

 

9780 OS 6 Bundle 905 does not have the exit problem when using the hardware back button. But when using history.back() in a trapping method nothing happens and there is no way to navigate to prior pages.

 

Torch OS 6 OS 6 Bundle 2534 has the well known exit problem when using hardware back button. When using history.back() in a trapping method everything works fine.

 

Neils UIMenu example is pretty straightforward and will show the above behaviour.