Jquery in combination with qml webview
-
Hi all,
I have a very simple qml page:
@import QtQuick 2.2
import QtWebKit 3.0import QtWebKit.experimental 1.0
Rectangle {
id: mes11width: 800 height: 430 x: 0 y: 50 color: "#565656" WebView { id: mesWebView width: parent.width height: parent.height anchors.fill: parent url: "http://10.237.66.106/FlexNet/Kiosk/Login.aspx?BackToStartPage=true" experimental.preferences.javascriptEnabled: true }
}
@- The html contains jquery function calls. Basically Ajax calls.
- The jquery library is stored on the webserver. Path of the jquery library is included in the html page.
If I use firefox or chrome and browse to this url the ajax calls are working.
If I use the qml webview they don't.Is this supposed to work with a qm webview (Qt 5.2.1, Webkit 3.0) or what do I need to do additionally?
-
Show log in DEBUG mode, enable console in webView desktop (if possible).
I try compile in my desktop your QML, but not showed... (invisible for me...) i try this:
@import QtQuick 2.2
import QtQuick.Controls 1.1
import QtWebKit 3.0import QtWebKit.experimental 1.0
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Hello World")menuBar: MenuBar { Menu { title: qsTr("File") MenuItem { text: qsTr("Exit") onTriggered: Qt.quit(); } } } WebView { id: mesWebView width: parent.width height: parent.height anchors.fill: parent url: "http://www.jquery4u.com/demos/ajax/" experimental.preferences.javascriptEnabled: true }
}
@Work fine for me...
So the problem must be in YOUR JAVASCRIPT (and not Jquery) that is a fault with that usually when we do not use "use strict;" the problem does not occur in some webbrowsers, but can occur in others.
Try using the "use strict;" and test your page in "google chorme" in "firefox". (READ ABOUT in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode)
You will probably see some normal mistakes WE usually do in javascript.
Good luck!