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

New Contributor
Posts: 6
Registered: ‎04-26-2012
My Device: 9790
My Carrier: plus


Question to developers writing applications for BlackBerry in WebWorks. In the application I open my browser using command 'blackberry.invoke'. On the site. Everything would be ok if not the fact that after submitting the form, script automatically redirects me to the mobile site that contains id post which I added.

It's a bit "not nice" way to inform the user that the application added his post. I tried to send the form in the background using AJAX but unfortunately I can't because the form must include parameter "action", because otherwise there is no user authentication and the script does not execute. Immediately emphasize that I don't have the possibility of interference in the page which redirects me to the form because it uses an external API. Maybe someone has an idea how to do it with Ajax, if there is such a solution that will perform the action form the background when you click 'submit'?

Thinking on a solution, I got the idea that maybe there is something like closing the browser automatically when it detects an appropriate content? I know that such a thing is possible in Java, in in WebWorks unfortunately I haven't found anything like that ...

Thanks and best regards!

Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: blackberry.invoke

Are you using an actual <form> element to submit an HTTP request?  If so that will reload the current page, and the net result may be to 


I would suggest you use Asyncronous JavaScript + XmlHttpRequst (also known as AJAX) to submit the HTTP request, and then dynamically update some content on your current page.  Can you post a snippet of how you tried to do this, and it wasn't working?  Are you doing a GET or a POST? 


Check out the following page for a code sample:




Follow me on Twitter: @n_adam_stanley
Your app doesn't work? Use BlackBerry remote web inspector to find out why.