Qt World Summit: Submit your Presentation

How to Share links on Facebook through QT?

  • I have tried Following Url ( "http://www.facebook.com/sharer.php?u="+"http://www.google.com"+&t=+"SearchEngine") but i have face the Problem of Java Scrip , that open the dialog of Yes and No
    after that, the Application is Crashed

    Although the Application share the URl on faceBook
    Through Simulator

    Thanks in Advance

  • Please provide more details about your scenario?
    Is this a native (c++) application creating a http request?
    Are you using a html page within a webkit control?
    Is it a qml application?

    If you are writing a c++ application and want to access facebook there is qt library that may help you. I have never tried but I know it exists and it is used on a maemo5 qt application.

  • I am using the the QwebView and have facing the Problems of Javascript message i.e ("The Script on this page appears to have a problem do you want to stop the Script.
    Yes No")
    Finally the Memory full Message Occurs and the Application is Crashed.
    I have used the following code.

    QWebSettings::globalSettings()->setAttribute(QWebSettings::JavascriptEnabled, true);
    ui->webView->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
    ui->webView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);

    QString urlString ="http://www.facebook.com/sharer.php?u=" + "http://www.google.com" + &t= + " SearchEngine" ;
    ui->webView->setUrl(QUrl(urlString) ) ;

    Thanks for your Reply.

  • are you sure the urlString has the right value? can you debug and find out

  • [quote author="syedasadalibs03" date="1290753813"]
    QString urlString ="http://www.facebook.com/sharer.php?u=" + "http://www.google.com" + &t= + " SearchEngine" ;
    ui->webView->setUrl(QUrl(urlString) ) ;

    The javascript shouldn't crash but neither should you use this string.
    You must encode, at least, the URL parameter (second string above).
    Try removing the "http://" from the second string and see if still crashes.

Log in to reply