WebNavigationRequest

Since: BlackBerry 10.0.0

#include <bb/cascades/WebNavigationRequest>

A utility class for the WebView::navigationRequested() signal.

This class contains information about the requested navigation, such as 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 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
    }
}


Overview

QML properties

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

QML signals

Public Functions Index

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

Signals Index

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

Properties

bb::cascades::WebNavigationRequestAction::Type action

The response action to the navigation request.

See also:

WebNavigationRequestAction

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

QUrl url[read-only]

The URL of the navigation request.

Since:

BlackBerry 10.0.0

Public Functions

WebNavigationRequest (

Constructs 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.

void accept ()

Accepts the navigation request.

Equivalent to setAction(WebNavigationRequestAction::Accept).

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 ignore ()

Ignores the navigation request.

Equivalent to setAction(WebNavigationRequestAction::Ignore).

Since:

BlackBerry 10.0.0

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

The type of navigation that caused this navigation request.

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

QUrl url ()

The URL of the navigation request.

Since:

BlackBerry 10.0.0

Signals

void actionChanged (

Emitted when the action on this request has changed.

Parameters
action

The new value of the action.

Since:

BlackBerry 10.0.0

Last modified: 2014-09-30



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus