Problem in opening embedded web page link
-
wrote on 19 Jan 2012, 11:09 last edited by
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 -
wrote on 19 Jan 2012, 11:21 last edited by
Please always wrap code in @-tags to enable code formatting. To so, click on the edit link right to the post.
-
wrote on 23 Jan 2012, 08:19 last edited by
I guess, you still have to override the function
QWebView* QWebView::createWindow (QWebPage::WebWindowType type) -
wrote on 25 Jan 2012, 08:33 last edited by
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.
-
wrote on 25 Jan 2012, 08:53 last edited by
- override QWebView
- implement the function createWindow:
QWebView* MyWebView::createWindow (QWebPage::WebWindowType type)
{
MyWebView* p = new MyWebView(0);
p->show();
return p;
}- create an instance of "MyWebView" and try it...
-
wrote on 25 Jan 2012, 08:56 last edited by
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.
-
wrote on 25 Jan 2012, 08:59 last edited by
"not able to move to embedded link"
Do you mean, you see a new window, but it remains empty (white)? -
wrote on 25 Jan 2012, 10:10 last edited by
NO it doesn't even open a new window.
Even I tried to override the function suggested by you, but it is never get calledNote :- I have set the attribute "QWebSettings::JavascriptCanOpenWindows" as true
-
wrote on 25 Jan 2012, 10:14 last edited by
please try to set in your WebPage the following attributes:
@
setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
setForwardUnsupportedContent(true);
@ -
wrote on 25 Jan 2012, 10:25 last edited by
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.
-
wrote on 30 Jan 2012, 15:18 last edited by
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 -
wrote on 8 Feb 2012, 09:02 last edited by
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.