Search code examples
facebooksslqmlqt5qwebkit

How to ignore SSL errors in Qt5 QML QWebKit 3.0?


I've got a problem showing www.facebook.com in Qt5 QML QWebKit 3.0.

The problem is with SSL certificate. There is a solution for Qt 4.*, but I need to implement this in the Qt 5.0.1 where all the API had changed.

The example solution for Qt 4.* could be found here link


Solution

  • Here is the solution, how you could ignore SSL errors from QML in Qt5. It helped me to show facebook page. I'm to use experimental API. The solution is correct for Qt 5.0.1 msvc2010 version in Windows 7 64bit.

    import QtWebKit 3.0
    import QtWebKit.experimental 1.0
    
    WebView {
        id: webView;
        url: "https://www.facebook.com";
        experimental.certificateVerificationDialog: Item {
            Component.onCompleted: {
                model.accept();
            }
        }
    }