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

Native Development

Posts: 410
Registered: ‎06-03-2010
My Device: Z10 Red
My Carrier: Free

Webview href

With the native browser, the "a" tag with a href to make a phone call, add a contact, etc... works.

But not with the webview. Did I miss something?



I speak about links like this one:



Posts: 31
Registered: ‎11-02-2012
My Device: Dev Alpha
My Carrier: None

Re: Webview href

this could help me right about now too.

Posts: 51
Registered: ‎11-23-2012
My Device: BB10 Dev Alpha
My Carrier: GiffGaff

Re: Webview href

WebView is just the Qt WebView - I assume it's just the core of the platform browser but it may not even be the same instance of WebKit.


Looks like the WebView is not hooked up to all the special URI handlers.


Simplest (slightly hacky) option is probably to catch the navigation requests for special URIs on the webview and use an Intent to send them to the browser.  Nicer solution would be to catch those requests and use the appropriate intent for each one.

Posts: 31
Registered: ‎11-02-2012
My Device: Dev Alpha
My Carrier: None

Re: Webview href

[ Edited ]

Yep was just thinking the same. Someone else on my team was already intercepting the requests using a WebResourceRequestFilter, on filterResourceRequest we can handle the urls manually. There are other ways to intercept webview requests, you don't have to use WebResourceRequestFilter. I just do it this way because this code was already in place on my project.


bool isPhoneNumber(QString str) {

  QRegExp numbers("^[+]?[0-9]*");

  return numbers.exactMatch(str);



In filterResouceRequest


if ( isPhoneNumber(path) ) {

  InvokeManager *invokeManager = new InvokeManager(this);

  QVariantMap map;

  map.insert("number", path);    // required


  QByteArray requestData = bb::PpsObject::encode(map, NULL);

  InvokeRequest request;






  InvokeTargetReply *reply = invokeManager->invoke(request);

  InvokeReplyError::Type error = reply->error();

  if ( error != InvokeReplyError::None ) {

    qDebug() << "error processing dialer " << error;

  } else {

    qDebug() << "dialed successfully " << error;

    return Filter;