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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Contributor
Posts: 10
Registered: ‎07-31-2012
My Device: PlayBook
My Carrier: CMCC
Accepted Solution

Any way to show back/forward menu item?

I'm just wrapping a mobile web link into a tablet app. So basically, the app shows the web URL page defined in config.xml. I want to add naviagation menu item like back and forward button, anyone knows how to do it?

 

Any way I could write some codes to make it just like a simple browser which links to a URL by default?

Thanks!

 

Kevin

Highlighted
Developer
Posts: 142
Registered: ‎07-27-2011
My Device: Red Z10, 32GB PlayBook, Numerous Android/WP8/FirefoxOS/Other devices
My Carrier: T-Mobile

Re: Any way to show back/forward menu item?

You can have links or buttons using the following code:

Forward:

href="javascript:history.go(-1)">


Back:

href="javascript:history.go(1)"

 

You can use onclick="" as well if you'd prefer.

-----------------------------------------------------------------------------------------



Contributor
Posts: 10
Registered: ‎07-31-2012
My Device: PlayBook
My Carrier: CMCC

Re: Any way to show back/forward menu item?

Thanks for your reply. But it seems not what I want.

I couldn't modify the URL page I specify in the content:src element in config.xml. So I wonder if there is some tricky ways to do so.
Developer
Posts: 142
Registered: ‎07-27-2011
My Device: Red Z10, 32GB PlayBook, Numerous Android/WP8/FirefoxOS/Other devices
My Carrier: T-Mobile

Re: Any way to show back/forward menu item?

Webworks doesn't give any good way to include an external Page that I'm aware of.

You might be able to use an iframe or embed the mobile webpage, and include navigation as well. However, the site owner could very easily block that (and may already have done so).

You can use child.browser, but it will not be BB10 compatible because it's based on flash.

 

Is the webpage static? The best option would be to simple include the HTML and js files within the app.

-----------------------------------------------------------------------------------------



Contributor
Posts: 10
Registered: ‎07-31-2012
My Device: PlayBook
My Carrier: CMCC

Re: Any way to show back/forward menu item?

The web page is HTML5 style page, and it works well within itself. But it has some links point to other site. After user clicks this kind of link, he could not get back again. That's my pain.
Developer
Posts: 142
Registered: ‎07-27-2011
My Device: Red Z10, 32GB PlayBook, Numerous Android/WP8/FirefoxOS/Other devices
My Carrier: T-Mobile

Re: Any way to show back/forward menu item?

That's easy then Smiley Happy package the site as an app, and set up the links to invoke the browser.
-----------------------------------------------------------------------------------------



Contributor
Posts: 10
Registered: ‎07-31-2012
My Device: PlayBook
My Carrier: CMCC

Re: Any way to show back/forward menu item?

Nice to talk with you. So how to make the links to invoke browser?
Developer
Posts: 142
Registered: ‎07-27-2011
My Device: Red Z10, 32GB PlayBook, Numerous Android/WP8/FirefoxOS/Other devices
My Carrier: T-Mobile

Re: Any way to show back/forward menu item?

[ Edited ]

Instructions are at https://developer.blackberry.com/html5/apis/blackberry.invoke.html

It looks as if the API just changed (I haven't tested the new function) but you have a javascript command that you call with onclick.

 

Untested (by me) sample:

 

function openWebLinkInBrowser() {
    // open web link in browser
    blackberry.invoke.invoke({
        target: "sys.browser",
        uri: "http://www.blackberry.com"
    });
}
<img src="image.png" onclick="openWebLinkInBrowser()" />
-----------------------------------------------------------------------------------------



Contributor
Posts: 10
Registered: ‎07-31-2012
My Device: PlayBook
My Carrier: CMCC

Re: Any way to show back/forward menu item?

Great!

Thanks very much for your help!