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
Contributor
Posts: 10
Registered: ‎05-20-2013
My Device: Blackberry q10
My Carrier: reliance

Cannot launch native blackberry BB10 browser as a separate session

This >button< code is what I've been using to open a site in a separate browser window:

<button type="button"onclick="window.open('http://someurl/somefile.htm','_blank')">CROR</button>

The >button< code works as expected when I'm using Eclipse/PhoneGap to develop my BlackBerry Z10 app. Tap on the button and the site opens in a separate window.

I'm in the process of switching to BlackBerry's WebWorks platform. When that same code is executed the browser window opens over top of my app. How do I get it to open in it's own window?

I've been through other examples I found on stackoverflow but they seem to deal with older Blackberry OS's and devices.

I've also looked at BlackBerry's doc's and they seem to be contradictory (I guess the platform is so new that it's evolving very quickly).

Thanks

BlackBerry Development Advisor
Posts: 762
Registered: ‎10-01-2009
My Device: All
My Carrier: N/A

Re: Cannot launch native blackberry BB10 browser as a separate session

I wrote a pretty good sample for the BlackBerry WebWorks GitHub repo. which will show you exactly how to do this. Essentially you can do it a couple of ways.

JavaScript

// topvar link = document.getElementById('vTop');
  link.addEventListener('click',function(e){
    e.preventDefault();
    childWindow = window.open('http://developer.blackberry.com','_top');});

Inline

<ahref="http://developer.blackberry.com"target="_top">Click Me</a>

Note that in WebWorks you'll want to 'white-list' the domain you're attempting to access as well. Check out the full sample here: BB10-WebWorks-Samples/ChildBrowser

Retired
Posts: 165
Registered: ‎09-24-2012
My Device: Passport
My Carrier: Bell

Re: Cannot launch native blackberry BB10 browser as a separate session

Hi gr8pathik,

 

window.open within a WebWorks application does not behave like it does in the browser. In a WebWorks application, it slides in from the bottom with a close button. This is by design. 

If you need access to more windows, I suggest using iframes or AJAX instead.

Developer
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: Cannot launch native blackberry BB10 browser as a separate session

As far as I understand it WW gives you two treads - use them both and things stop happening

 

You can always use invoke to open something else though




Click the like button if you find my posts useful!