Important: Please read the Qt Code of Conduct -

Problem in opening embedded web page link

  • Hi,
    I am using QWebView to load my html content which brings up a flash. This flash has an embedded link to different web page. When I click on this flash content my new web page is not getting open.
    Below is the source code.
    but same thing if I will do through QWebView->load(QURL("PATH TO FLASH")), it works fine!!!

    QWebView * parentView = new QWebView();
    parentView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
    parentView->setHtml(QString("<html><body topmargin="0" leftmargin="0"><embed type="application/x-shockwave-flash" src="" width="750" height="240" quality="high" bgcolor="#FFFFFF" NAME="script" ALIGN="" wmode="transparent"></body></html>"));
    parentView->setGeometry(100,100,750, 240);


  • Please always wrap code in @-tags to enable code formatting. To so, click on the edit link right to the post.

  • I guess, you still have to override the function
    QWebView* QWebView::createWindow (QWebPage::WebWindowType type)

  • Hi,
    Thank you for your reply. I am bit confused by the solution suggested by you.
    Would you please explain this more exactly what you mean to say here.

    Additionally, I tried to connect signal urlchanged in that case I am getting this signal when direct url is present and if given as a html doc I am not getting this signal.

    1. override QWebView
    2. implement the function createWindow:

    QWebView* MyWebView::createWindow (QWebPage::WebWindowType type)
    MyWebView* p = new MyWebView(0);
    return p;

    1. create an instance of "MyWebView" and try it...

  • Even though if I am saving this above mentioned html code in a html file and then trying to open that file using any browser , after clicking on the flash content , browser itself is not able to move to embedded link.

  • "not able to move to embedded link"
    Do you mean, you see a new window, but it remains empty (white)?

  • NO it doesn't even open a new window.
    Even I tried to override the function suggested by you, but it is never get called

    Note :- I have set the attribute "QWebSettings::JavascriptCanOpenWindows" as true

  • please try to set in your WebPage the following attributes:

  • I tried to call those functions as well but it failed to open an embedded flash link.

    As I mentioned above that if I will open it using load(QURL("url path to flash")) function instead of setHTML() , then it works fine, my question here is , there are some contents that require some additional data to passed in then how can I give those data.

    For Ex. If I wanted to open some youtube flash content it requires some flashvars arguments to be passed in(that I guess webview passes down to adobe flash player), so that reason I am preparing html doc.

    Is there any way so that we can just load QUrl , and then later feed the other argumets(e.g. flashvars = "...bla bla", quality = "medium"....etc) , to webview.

  • Hi Guyz,

    Eventually I made it work. We can retirve the embedded page url and the property wheather a new page should open in new window or not.

    setHtml() function of QWebView accepts second parameter, that is the base url.
    In my problem statement I was preparing html doc for the flash present in that page but was not setting the base url(nothing but page url), after setting it every embedded link inside the flash started working for me.

    Thanks to "Privet" for his help as he mentioned in the post above to override the createWindow() function so that if any url has to be opened in a new window/tab this function will get callled.


  • Unfortunately I encountered one more problem. I need to detect exactly that URL will open new window OR new tab.

    Overridden of CreateWindow() informs about opening of URL in new window/tab.

    How to differentiate between these two.

Log in to reply