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
New Contributor
Posts: 4
Registered: ‎06-29-2011
My Device: Many
My Carrier: Many

Can I invoke the BB Browser from a remote JavaScript file?

Hello all,

 

I have a webworks app that needs to invoke the BB browser with a certain URL. 

 

When I have the JavaScript file and HTML page embedded in my webworks application on the device, the browser is invoked correctly. 

 

However, when I have the same HTML and JS file served from a remote server, and my web works application's "content src" pointed to the remote URL of the HTML page, the browser is not invoked when my JS executes. 

When trying to invoke the browser, it returns the error 'blackberry.invoke is undefined.'

 

Here is my javascript function:

 

 

function displayLink(link){

if(typeof blackberry !== 'undefined'){

alert("Trying to launch BB Browser");

try{

alert("invoke: "+blackberry.invoke);

var args = new blackberry.invoke.BrowserArguments(link);

 blackberry.invoke.invoke(blackberry.invoke.APP_BROWSER, args);

}catch(e){

alert(e.message);

}

}else{

window.location=link;

}

 

 

My config XML requires blackberry.identity, blackberry.invoke, blackberry.invoke.BrowserArguments, and blackberry.invoke.JavaArguments. 

 

Is it possible to invoke native BB apps from a remote JS file in a WebWorks application?

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

Re: Can I invoke the BB Browser from a remote JavaScript file?

If you are bringing in a remote page that requires access to APIs you need to declare them for that origin.  If your page is coming from http://www.foo.com and you want to provide access to say blackberry.system your config should look like the following

 

<access uri="http://www.foo.com" subdomains="true">
  <feature id="blackberry.system" />
</access>

 This is done to ensure that when you bring in content from outside domains you need to explicitly declare which APIs they can access.  This ensures that outside content is controlled on what can be executed.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Highlighted
New Contributor
Posts: 4
Registered: ‎06-29-2011
My Device: Many
My Carrier: Many

Re: Can I invoke the BB Browser from a remote JavaScript file?

Thank you for your quick reply, that is exactly what I needed!