WebNavigationRequest

#include <bb/cascades/WebNavigationRequest>

A utility class for the bb::cascades::WebView::navigationRequested signal.

This class contains information about the requested navigation, like URL and navigation type, and it is possible to decide the response action to the request by setting the action property. You can also call WebNavigationRequest::ignore() to reject the request.

Here's a simple QML example snippet demonstrating the use of a WebNavigationRequest:
onNavigationRequested: {
    console.log("NavigationRequested: " + request.url + " navigationType=" + request.navigationType)
    if (shouldAcceptNavigationToUrl(request.url)) {
        request.action = WebNavigationRequestAction.Accept
    } else {
        request.action = WebNavigationRequestAction.Ignore
    }
}
Since:

BlackBerry 10.0.0

QML properties

url: QUrl [read-only]
action: bb::cascades::WebNavigationRequestAction::Type
navigationType: bb::cascades::WebNavigationType::Type [read-only]

QML signals

Public Functions Index

WebNavigationRequest (const QUrl &url, bb::cascades::WebNavigationType::Type navigationType, QObject *parent=0)
~WebNavigationRequest ()
QUrlurl () const
bb::cascades::WebNavigationType::TypenavigationType () const
bb::cascades::WebNavigationRequestAction::Typeaction () const
voidsetAction (bb::cascades::WebNavigationRequestAction::Type action)
voidaccept ()
voidignore ()

Signals Index

voidactionChanged (bb::cascades::WebNavigationRequestAction::Type action)

Properties

QUrl url[read-only]

The URL of the navigation request.

Since:

BlackBerry 10.0.0

bb::cascades::WebNavigationRequestAction::Type action

The response action to the navigation request.

This will default to WebNavigationRequestAction::Accept which means that the navigation will proceed if nothing is changed. To block the navigation request, change this to WebNavigationRequestAction::Ignore.

Since:

BlackBerry 10.0.0

bb::cascades::WebNavigationType::Type navigationType[read-only]

The type of navigation that caused this navigation request.

Since:

BlackBerry 10.0.0

Public Functions

WebNavigationRequest (

Construct a WebNavigationRequest from a url, status, and optional parent.

WebLoadRequests are created internally and passed as a parameter to the WebView::navigationRequested signal.
Since:

BlackBerry 10.0.0

~WebNavigationRequest ()

Destructor.

QUrl url ()

The URL of the navigation request.

Since:

BlackBerry 10.0.0

bb::cascades::WebNavigationType::Type navigationType ()

The type of navigation that caused this navigation request.

Since:

BlackBerry 10.0.0

bb::cascades::WebNavigationRequestAction::Type action ()

The response action to the navigation request.

This will default to WebNavigationRequestAction::Accept which means that the navigation will proceed if nothing is changed. To block the navigation request, change this to WebNavigationRequestAction::Ignore.

Since:

BlackBerry 10.0.0

void setAction (

The response action to the navigation request.

This will default to WebNavigationRequestAction::Accept which means that the navigation will proceed if nothing is changed. To block the navigation request, change this to WebNavigationRequestAction::Ignore.

Since:

BlackBerry 10.0.0

void accept ()

Accept the navigation request.

Equivalent to setAction(WebNavigationRequestAction::Accept)

Since:

BlackBerry 10.0.0

void ignore ()

Ignore the navigation request.

Equivalent to setAction(WebNavigationRequestAction::Ignore)

Since:

BlackBerry 10.0.0

Signals

void actionChanged (

Signal that the action on this request has changed.

Parameters
action

The new value of the action.

Since:

BlackBerry 10.0.0