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 Contributor
ahrepost
Posts: 4
Registered: ‎07-17-2012
My Device: BB10 DA
My Carrier: XL AXIATA

How to invoke browser with onclick function on a text-arrow-list?

Hi..

 

I'm trying to make my first app for blackberry :smileyhappy:

 

I need to open remote URL to a new browser from a text-arrow-list

 

i've managed to open the browser, but it doesn't load the URL specified. (it doesn't load anything)

 

sample of my code:

 

<div data-bb-type="text-arrow-list" data-bb-image-effect="fade">


        <div data-bb-type="item" onclick="blackberry.invoke.BrowserArguments('http://www.blackberry.com');
        blackberry.invoke.invoke(blackberry.invoke.APP_BROWSER);" data-bb-title="blackberry">BlackBerry</div>

 

</div>

 

can it be done? can someone correct my code?

 

thanks a lot :smileyhappy:

 

Please use plain text.
Administrator
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: How to invoke browser with onclick function on a text-arrow-list?

[ Edited ]

Yes, here is the correction.  You need to create a variable for the BrowserArguments object and pass that into the invoke() method, like this:

 

<script>
function openBrowser() {
   var args = blackberry.invoke.BrowserArguments('http://www.blackberry.com');
   blackberry.invoke.invoke(blackberry.invoke.APP_BROWSER, args);
}
</script>

<div data-bb-type="text-arrow-list" data-bb-image-effect="fade">
        <div data-bb-type="item" onclick="openBrowser()" data-bb-title="blackberry">BlackBerry</div>
</div>

 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Please use plain text.
Developer
scrid2000
Posts: 142
Registered: ‎07-27-2011
My Device: Red Z10, 32GB PlayBook, Numerous Android/WP8/FirefoxOS/Other devices
My Carrier: T-Mobile

Re: How to invoke browser with onclick function on a text-arrow-list?

It looks like bbui; I could be mistaken, but I think you'll need to put the javascript code into the index.htm rather than right into the sub htm file you're using.

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



Please use plain text.
New Contributor
ahrepost
Posts: 4
Registered: ‎07-17-2012
My Device: BB10 DA
My Carrier: XL AXIATA

Re: How to invoke browser with onclick function on a text-arrow-list?

thanks for the reply

 

but i can't get your code to work

 

explanation on what i'm trying to do is:

 

index.htm pushScreen: home.htm → (contains image-list)

each image-list in home.htm contains a few text-arrow-list

 

now i need those text-arrow-list to open individual remote URL.

 

 

I also encountered touch sensitivity problem on my app, sometimes i have to touch the image-list / text-arrow-list a view times for it to respond. i use the code posted by tneil on github for my config.xml n index.htm

 

 

thanks

 

Please use plain text.
Trusted Contributor
NitishSubudhi
Posts: 166
Registered: ‎12-09-2011
My Device: 9550,9300,9800,9700,9900,9850,9860

Re: How to invoke browser with onclick function on a text-arrow-list?

[ Edited ]

Hi,

Use this code:

 

function openLink(anchorObject) {

	var args = new blackberry.invoke.BrowserArguments(""
			+ $(anchorObject).attr("url") + "");
	blackberry.invoke.invoke(blackberry.invoke.APP_BROWSER, args);
}

<a onclick='openLink(this)' url='http://www.blackberry.com'><div data-bb-type="text-arrow-list" data-bb-image-effect="fade">

        <div data-bb-type="item"  data-bb-title="blackberry">BlackBerry</div>
 
</div></a>

 

Use the above code in javascript part.
 

Thanks & Regards,
Nitish Subudhi

Feel Free To Press The Like Button On The Right Side To Thank The User That Helped You.
Please Mark Posts As Solved If You Found a Solution.
Please use plain text.