Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. Problem in opening embedded web page link
Forum Updated to NodeBB v4.3 + New Features

Problem in opening embedded web page link

Scheduled Pinned Locked Moved Qt WebKit
12 Posts 3 Posters 7.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aashish.lg
    wrote on last edited by
    #1

    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="http://www.wyse.com/img/splash/p1_flash_banner.swf" width="750" height="240" quality="high" bgcolor="#FFFFFF" NAME="script" ALIGN="" wmode="transparent"></body></html>"));
    parentView->setGeometry(100,100,750, 240);
    parentView->show();
    @
    WORKING CODE:-
    @
    parentView->load(QUrl("http://www.wyse.com/img/splash/p1_flash_banner.swf"));

    @
    Regards
    Ashish

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

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

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • P Offline
        P Offline
        privet
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • A Offline
          A Offline
          aashish.lg
          wrote on last edited by
          #4

          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 Reply Last reply
          0
          • P Offline
            P Offline
            privet
            wrote on last edited by
            #5
            1. override QWebView
            2. implement the function createWindow:

            QWebView* MyWebView::createWindow (QWebPage::WebWindowType type)
            {
            MyWebView* p = new MyWebView(0);
            p->show();
            return p;
            }

            1. create an instance of "MyWebView" and try it...
            1 Reply Last reply
            0
            • A Offline
              A Offline
              aashish.lg
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              • P Offline
                P Offline
                privet
                wrote on last edited by
                #7

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

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  aashish.lg
                  wrote on last edited by
                  #8

                  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

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    privet
                    wrote on last edited by
                    #9

                    please try to set in your WebPage the following attributes:
                    @
                    setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
                    setForwardUnsupportedContent(true);
                    @

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      aashish.lg
                      wrote on last edited by
                      #10

                      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.

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        aashish.lg
                        wrote on last edited by
                        #11

                        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.

                        Regards
                        Ashish

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          aashish.lg
                          wrote on last edited by
                          #12

                          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.

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved