Welcome!

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

Reply
Developer
fredoust
Posts: 75
Registered: ‎09-12-2012
My Device: Looking for a BB10 testing device
My Carrier: Developper
Accepted Solution

Webview navigationrequested ignore() is not a function

Hi all,

I want to catch when a link is clicked in my webview and then ignore it.

So i found this in the doc :

https://developer.blackberry.com/cascades/reference/bb__cascades__webview.html#navigationrequested

 

But I get the error : ignore is not a function, also with accept, do I forget something ?

 

Thanks.

---------
Mobile developer freelance - QtQuick - Cascades - WP7 - Android
My works : http://fdelgado.fr
Please use plain text.
Developer
kylefowler
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: Webview navigationrequested ignore() is not a function

What does your code look like? That error makes it seem like you are just trying to call ignore(). You need to call something like request.ignore() depending on what your handler looks like
Like all of my posts
Please use plain text.
Developer
fredoust
Posts: 75
Registered: ‎09-12-2012
My Device: Looking for a BB10 testing device
My Carrier: Developper

No I Re: Webview navigationrequested ignore() is not a function

No I copy paste the doc

 

onNavigationRequested: {
    console.log("NavigationRequested: " + request.url + " navigationType=" + request.navigationType)
    if (!shouldAcceptNavigationToUrl(request.url)) {
        request.ignore();
    }
}
---------
Mobile developer freelance - QtQuick - Cascades - WP7 - Android
My works : http://fdelgado.fr
Please use plain text.
Developer
kylefowler
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: No I Re: Webview navigationrequested ignore() is not a function

onNavigationRequested: {
console.log("NavigationRequested: " + request.url + " navigationType=" + request.navigationType) if (shouldAcceptNavigationToUrl(request.url)) { request.action = WebNavigationRequestAction.Accept } else { request.action = WebNavigationRequestAction.Ignore } }

 

This is what it should be according to the docs

Like all of my posts
Please use plain text.
Developer
fredoust
Posts: 75
Registered: ‎09-12-2012
My Device: Looking for a BB10 testing device
My Carrier: Developper

Re: No I Re: Webview navigationrequested ignore() is not a function

Thanks ! It seems to work for : request.action = WebNavigationRequestAction.Ignore

But when I click I get the error that it doesn't know shouldAcceptNavigationToUrl.

 

Thanks.

---------
Mobile developer freelance - QtQuick - Cascades - WP7 - Android
My works : http://fdelgado.fr
Please use plain text.
Developer
kylefowler
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: No I Re: Webview navigationrequested ignore() is not a function

Well yeah, that would be a qml function that you would have to define to decide if you want to process that url.
Like all of my posts
Please use plain text.
Developer
fredoust
Posts: 75
Registered: ‎09-12-2012
My Device: Looking for a BB10 testing device
My Carrier: Developper

Re: No I Re: Webview navigationrequested ignore() is not a function

Ok thanks for all !

---------
Mobile developer freelance - QtQuick - Cascades - WP7 - Android
My works : http://fdelgado.fr
Please use plain text.