what is correct way to ignore certificate errors in qml webEngineView? this one didnt work for me! qt documentation is so bad about web engine view here is certificate page : certificate error
WebEngineView {
id:webView
certificateError: WebEngineCertificateError.ignoreCertificateError()
}
You have to do it when the WebEngineView notifies through the signal certificateError:
WebEngineView {
id:webView
onCertificateError: error.ignoreCertificateError()
}
Related
I'm following the Facebook Auth tutorial on the Firebase website. You can see it here: https://www.firebase.com/docs/web/libraries/ionic/guide.html
$scope.login = function() {
Auth.$authWithOAuthRedirect("facebook").then(function(authData) {
// User successfully logged in
}).catch(function(error) {
if (error.code === "TRANSPORT_UNAVAILABLE") {
Auth.$authWithOAuthPopup("facebook").then(function(authData) {
// User successfully logged in. We can log to the console
// since we’re using a popup here
console.log(authData);
});
} else {
// Another error occurred
console.log(error);
}
});
};
My issue is that I am correctly receiving the TRANSPORT_UNAVAILABLE error and I am getting to the following line of code
Auth.$authWithOAuthPopup("facebook").then(function(authData) {
// do stuff with the authData
})
But, when I run on my device or in emulator, the popup window that is coming from the InAppBrowser Plugin closes immediately and doesn't allow me to enter any of my credentials.
EDIT
Two things to note. First, with the above code auth does not work when done via the browser. So, if I do ionic serve and try to login nothing happens except that I see the url change briefly to http://localhost:8100/#/login&__firebase_request_key=0wRrfF07Ojg1PmJXNX1OsvrRFR2Q1LGj
but then it goes back to http://localhost:8100/#/login
Secondly, when I build the project via Xocde and run on my device, the InAppBrowser plugin seems to no longer be closing right away but instead freezes with a white screen. The logs in Xcode show the following
THREAD WARNING: ['InAppBrowser'] took '79.103027' ms. Plugin should use a background thread.
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
webView:didFailLoadWithError - -1200: An SSL error has occurred and a secure connection to the server cannot be made.
EDIT 2
Looks like the above issues with SSL error was because of an unrelated bug with upgrading to ios 9. I've since corrected those issues and now I'm back to the original. Except now the InAppBrowser window doesn't even open, I'm still hitting the catch block with TRANSPORT_UNAVAILABLE.
Not sure exactly how I fixed this issue. Hard to isolate what was breaking originally and what was breaking due to ios 9 upgrades. But, I've been able to fix the issue. I started by blowing away the /ios and /android folders inside of /platforms. I also deleted all the plugins from the /plugins folder.
Then I added back ios and android platforms. Then I added back the plugins. Then I followed the steps found in these 2 blog posts modifying your app to be ios 9 compliment.
http://blog.ionic.io/ios-9-potential-breaking-change/
http://blog.ionic.io/preparing-for-ios-9/
I'm trying to get the console log output from a Qt 5 WebView web page, but I cannot find out how to do it.
Maybe some out you out there can help me?
I have tried to enable the web inspector that is supposed to show up when you right click the web page, but nothing happens when I do that. I have set up an inspector port (on 1111) by setting the environment variable QTWEBKIT_INSPECTOR_SERVER to 1111. And I am able to get a page that has this on it:
Inspectable web views
LOG TEST [http://MY_LAN_IP:8880/logtest.html]
But when I click the link I get this error:
WebSocket connection to 'ws://localhost:1111/devtools/page/1' failed: Error during WebSocket handshake: Sent non-empty 'Sec-WebSocket-Protocol' header but no response was received
inspector.js:341 Event {clipboardData: undefined, path: NodeList[0], cancelBubble: false, returnValue: true, srcElement: WebSocket…}
View.js:363 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.
For demo purposes I have a web page on a local web server that looks like this:
<!DOCTYPE html>
<html>
<head>
<title>LOG TEST</title>
</head>
<body>
<h1>Logging to console...</h1>
<script>
setInterval(function() {
console.log("This is a log message");
console.error("This is an error message");
}, 1000);
</script>
</body>
</html>
The QML file looks like this:
import QtQuick 2.2
import QtQuick.Window 2.1
import QtWebKit 3.0
import QtWebKit.experimental 1.0
Window {
visible: true
width: 360
height: 360
WebView {
url: "http://MY_LAN_IP:8880/logtest.html"
anchors.fill: parent
experimental.preferences.developerExtrasEnabled: true
experimental.preferences.navigatorQtObjectEnabled: false
}
}
Following this link I successfully show my logs from a webpage embedded in a QML WebView.
In your post you are really near of the goal.
You must :
Set the runtime environment variable QTWEBKIT_INSPECTOR_SERVER to whatever you want (so why not 1111).
In the QML file import QtWebKit.experimental 1.0
and in the webview properies add : experimental.preferences.developerExtrasEnabled: true
Then, when you launch your application you must have the following output trace :
Inspector server started successfully. Try pointing a WebKit browser to http://127.0.0.1:1111
To debug your page, open your favorite web browser and go to http://127.0.0.1:1111, and its done !
So the interface has changed, in old QtWebKit you must right click on the web view to debug the page, now you must connect to the server thanks to a web browser.
to download a console returns the following error:
Frame load interrupted by policy change
Example:
Start Download
Console Preview:
Should I configure something in the Compiler or QWebSettings?
I discovered.
In conventional Webkit browsers, the place to download the console shows how the request canceled, so before turning to "download manager" of the browser the request should be canceled.
solution:
//replace [QWebView] by your WebView
connect([QWebView]->page(), SIGNAL(unsupportedContent(QNetworkReply*)),
this, SLOT(downloadContent(QNetworkReply*)));
...
void [main class]::downloadContent(QNetworkReply *reply){
//Replace "[main class]" by "Class" having the signs used in WebView.
[QWebView]->stop();
//solution: stop loading --replace [QWebView] by your WebView
/*function to donwload*/
}
Edit: hard to tell without a proper backtrace I requested in the comments, but it looks like the warning might actually be harmless.
Original:
That's because the QWebView doesn't know what to do with your app.exe file -- it's not an HTML page or a text/plain document or a supported image, after all. The QWebView class is not a web browser; you apparently want to start a download of some file, but there's no full-blown download manager in that class. You will have to provide your own code for this -- the code will have to ask for a proper location to save it, etc.
You can start with QWebPage::setLinkDelegationPolicy and handle this particular click yourself.
I used the webview of qml to make a small browser, and it works fine.
Problem is, when there is a network with proxy set for it, it fails.
Try 1.
I read from here about the QDeclarativeNetworkAccessManagerFactory class and tried to set proxy only for my qml Application, but it did not work.
Try 2.
I read and tried to set the Application wide proxy with this code:
QNetworkProxy proxy;
proxy.setType(QNetworkProxy::HttpProxy);
proxy.setHostName("proxy.foo.com");
proxy.setPort(8080);
proxy.setUser("itsme");
proxy.setPassword("really");
QNetworkProxy::setApplicationProxy(proxy);
But it did not work. Any idea how to proceed?
Edit:
I am getting this message in the output :
QNetworkAccessCache::addEntry: overriding active cache entry > 'auth:proxy-> > http://proxy.foo.com:8080'
I have a small application based on Sencha touch. this application should submit data to the server lets say this is an example of Ajax call that I did
Ext.Ajax.request({
url: 'http://www.google.com',
timeout:30*1000,
success: function(response, opts) {
console.dir('success');
},
failure: function(response, opts) {
console.log('server-side failure with status code ' + response.status);
}
Now the
failure
never gets called if I have a network connection but without internet !! the problem that I have my client does not have a solid internet connection but he has a wifi all the time !
So , everything I found on the net detect if I have a Network connection ! but I already have one but this connection does not provide Internet.
anyone knows how to detect the Internet connection not the Network?
FYI : I tried the navigator.online and the network state examples all of them does not detect internet, also I attached a phoneGap listener since I'm using sencha with phoneGap to create a iOS app !
EDIT: I'm using Sencha v1.1
alert(Ext.device.Connection.isOnline());
Here's url,
http://docs.sencha.com/touch/2-0/#!/api/Ext.device.Connection
You can also detect the connection using PhoneGap. See: http://docs.phonegap.com/en/1.9.0/cordova_connection_connection.md.html
If the success callback is being invoked, then you best check the response parameter for null and/or length. If you find null or zero length, then assume the request failed.