[SailfishDevel] Webview and clicking on external link

Zoltán Lutor zoltan.lutor at gmail.com
Fri Jan 29 20:54:36 UTC 2016


What did you mean with "*in some parent object and call the function from
within the webview*"?
Solution below did not do the trick - link is still opened in the same
webview...

Item

{

      id: htmlContentViewer


    WebView {

        id: webViewer

        anchors.fill: parent

        onNavigationRequested : {

            console.debug("request.url: ", request.url)

            if (request.navigationType === WebView.LinkClickedNavigation) {

                request.action = WebView.IgnoreRequest

                //Qt.openUrlExternally(request.url)

                goExternal(request.url)

            }

        }

    }


    // fancy Sailfish - WebView? - issue...

    function goExternal( url ) { Qt.openUrlExternally(url) }

}


2016-01-28 22:21 GMT+01:00 Michael Fuchs <michfu at gmx.at>:

> Place the Qt.openUrlExternally(request.url) in a function in some parent
> object and call the function from within the webview.
>
> On Donnerstag, 28. Jänner 2016 21:55:49 CET Zoltán Lutor wrote:
> > Hi,
> >
> > Any idea how to open link clicked in webview in browser application?
> > Code below does not do the trick - rather opens link inside the webview
> > itself...
> >
> >
> http://doc.qt.io/qt-5/qml-qtwebkit-webview.html#onNavigationRequested-signal
> >
> > WebView {
> >
> >         id: webViewer
> >
> >         anchors.fill: parent
> >
> >         onNavigationRequested : {
> >
> >             console.debug("request.url: ", request.url)
> >
> >             if (request.navigationType ===
> WebView.LinkClickedNavigation) {
> >
> >                 request.action = WebView.IgnoreRequest
> >
> >                 Qt.openUrlExternally(request.url)
> >
> >             }
> >
> >         }
> >
> >     }
> >
> >
> > Thx,
> >
> >
> > Zoltan
>
>
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscribe at lists.sailfishos.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20160129/39facf11/attachment.html>


More information about the Devel mailing list