← Back to team overview

ubuntu-touch-coreapps team mailing list archive

UbuntuWebView component

 

For everyone interested in embedding a webview in their application, I
recommend using UbuntuWebView, a custom WebView with added functionality
and rendering tweaks.

This component is part of
the qtdeclarative5-ubuntu-ui-extras-browser-plugin package, and it can be
imported like so:

    import Ubuntu.Components.Extras.Browser 0.1


There is currently no public documentation, unfortunately.
However UbuntuWebView extends QtWebKit’s WebView (
http://qt-project.org/doc/qt-5.0/qtwebkit/qml-qtwebkit3-webview.html), so
it has the same properties and methods.

What the UbuntuWebView offers as added value:
 - a unified user agent string (work is ongoing to pick a proper one)
 - handling of links that request opening another window
 - a selection mechanism to copy/share data
 - a default item selector for <select> HTML tags
 - scrollbars by default
 - an embedded thumbnailer that generates thumbnails for web pages on disk

If you’re interested in the implementation details and available
functionality, the code is there:
http://bazaar.launchpad.net/~phablet-team/webbrowser-app/trunk/view/head:/src/Ubuntu/Components/Extras/Browser/UbuntuWebView.qml
.

Using an UbuntuWebView in your application (as opposed to a plain WebView)
will guarantee a consistent behaviour and rendering across all applications.

Feel free to direct me any questions and suggestions regarding this
component.
Contributions (in the form of bug fixes and patches) are also very welcome,
the code lives at lp:webbrowser-app.

Cheers,

 Olivier