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
New Developer
crwblyth
Posts: 28
Registered: ‎05-05-2011
My Device: BlackBerry Curve 9300
My Carrier: T-Mobile
Accepted Solution

Push every href link to PlayBook browser.

I know how to invoke the browser to load a website, but let's say;

 

I'm using an RSS feed and the content contains href links. How do I push all of those links to load in the browser instead of in app?

I've tried various work arounds but still cannot seem to make it function.

 

Help appreciated,

Crwblyth 

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: Push every href link to PlayBook browser.

[ Edited ]

Hello Crwblyth,

 

Once the <a> elements are loaded, my thought is that you would need to override the behaviour of the onclick (to invoke your JavaScript implementation of browser invoking), and also likely set the href attribute to "#" to prevent the default URL from taking any action.

 

HTML5 has querySelector and querySelectorAll (depending on your needs) implementations for you to get easier access to, for instance, all the anchor elements.

 

Let me know if you have any questions.

 

Erik Oros

BlackBerry Development Advisor


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Please use plain text.
New Developer
callumcarolan
Posts: 9
Registered: ‎03-10-2012
My Device: BlackBerry Playbook
My Carrier: N/A

Re: Push every href link to PlayBook browser.

[ Edited ]

I did it like this

 

 

$('a').click(function(e){
e.preventDefault();
href = $(this).attr('href');
var args = new blackberry.invoke.BrowserArguments(href);
blackberry.invoke.invoke(blackberry.invoke.APP_BROWSER, args);
return false;
});

Please use plain text.