Pages Menu
Categories Menu

Posted on Sep 3, 2013 in DevBlog Sofia | 3 comments

Invocation going deep down: app internal hyperlinks

Invocation going deep down: app internal hyperlinks

One of my latest projects was a WebWorks app in which I had to use static html pages kind of as a dictionary. In short, a user would search for a given keyword and would then get the keyword explanation.

Because all the information was in static html pages I decided to redesign the app and make it completely offline, thus incorporating the static html in the app itself. This had certain advantages: no need of data usage, no wait times (due to server lag) and it could also be used on airplanes. So far so good.

However, in the middle of the development process I stumbled upon an issue: the static pages contained internal hyperlinks, i.e. links from one page to another. The simplest solution was just to wipe out all hyperlinks leaving only plain text for the users, but this would limit the app functionality.. So how could I solve this?


Luckily I saw this great post about BlackBerry Invocation Framework: Invoke My App, and once I got the basic idea it was easy to implement it.

So first, the config file:

<rim:invoke-target id=”com.mydomain.myApp”>





<property var=”uris” value=”myAp://” />




Next the actual implementation:

function listenToInternalLinks() {

blackberry.event.addEventListener(“invoked”, function (invocationInfo){

if (invocationInfo.uri) {

// here we got our internal link uri: “myApp://keyword”

toast(‘URI ‘ + invocationInfo.uri);

// just extract the keyword and process it





And the last thing was to replace all hyperlinks like

<a href=””>Keyword</a>


<a href=’myApp://keyword’>Keyword</a>


Now whenever the user sees a hyperlink and clicks it, it just opens a new page in the same app window, and the app is still offline. Cool isn’t it?


by Tihomir Hristov,

Sofia developer group manager



Share this post:


  1. You could have used relative hyperlinks (without a host):


    Or even named anchors:


    • Ok, this site decided to embed my HTML and thus screw up my examples. Now with square-tagged html:


      [a href="html/dictionary/word.htm"]word[/a]

      named anchors:

      [a href="html/dictionary.htm#word"]word[/a]

  2. Hi and thanks for joining the discussion :) Actually I simplified my real issue a bit. Because I wanted to introduce real search engine for the entire dictionary I just cut in pieces the static html pages, making tuples keyword-description and saved it to a local DB. Thus the app could easily search after given keyword (the other solution would be to leave the static html pages and to scan the text, which would be IMHO a performance overkill). So at the end of the day I just had a piece of original HTML with a hyperlink inside, which pointed to nowhere.

    Still (if no search engine feature) your solution is elegant and easy, I’ve noted it for future projects :)

Post a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>