In QML I want to use WebView , but the WebView.back does not work. Is there some way how to navigate, or do I have to store all the previous paths and navigate between them manualy using javascript function ?
1 Answer
You need to use WebView goBack() instead of just "back". The following code shows how to use it in a very minimal browser:
import QtQuick 2.0
import Ubuntu.Components 0.1
import QtWebKit 3.0
Rectangle {
id: mainRect
width: 1280
height: 720
Button {
id: backButton
text: "Back"
onClicked: {
if (webview.canGoBack) {
webview.goBack()
}
}
}
WebView {
id: webview
url: "http://askubuntu.com"
anchors {
top: backButton.bottom
bottom: mainRect.bottom
left: mainRect.left
right: mainRect.right
}
}
}