Search code examples
flashqtexternalinterfaceqtwebkitqwebview

How to access Flash ExternalInterface from QWebView?


Is it possible to access Flash's ExternalInterface from QWebView? If so, how can it be done?


Solution

  • You could try accessing it via executing JavaScript in the page.

    To run JavaScript on the page use QWebFrame::evaluateJavaScript, for example:

    QWebView* webView;
    // ...
    QString jsQuery("document.getElementById(\"flashobj\").flashFunc(1);");
    QVariant result = webView->page()->mainFrame()->evaluateJavaScript(jsQuery);
    

    Note: I've not tested this code, or even tried accessing Flash before via QtWebKit so this may not work for Flash, although it does work for JavaScript objects.