PDA

View Full Version : Difficulties in working with Webview



MrCoder
17th April 2016, 16:06
Hi I have used in your application webview when I open a site with it and I click on the Download link and no further action will not download files Please do guide me
thanks

anda_skoa
17th April 2016, 16:16
You forgot to post the code of your webview usage.

Cheers,
_

MrCoder
17th April 2016, 16:22
You forgot to post the code of your webview usage.

Cheers,
_

Oh sorry I forgot


import QtQuick 2.3
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtWebKit 3.0
WebView {
id: webView1
url:"..."
opacity: 0
width: Window.width
height: Window.height
objectName: "myWebView"
focus: true
}

anda_skoa
17th April 2016, 16:37
Ah.

You need the "download request" handler from the experiemental module



import QtQuick 2.0
import QtWebKit 3.0
import QtWebKit.experimental 1.0

WebView {
experimental.onDownloadRequested: {

// set a download directory, keep suggested file name
downloadItem.destinationPath = "downloads/" +
downloadItem.suggestedFilename

// start download
downloadItem.start()
}
}


Cheers,
_

MrCoder
17th April 2016, 16:46
Thanks for the help
I have two more questions
When the links that I click on another window opens in webview does not work what to do?
I downloaded the files that are downloaded by IDM
I will be grateful for help <3

anda_skoa
17th April 2016, 23:00
I am afraid I didn't understand that.

You click on a link in the webview?
And another window opens?

Cheers,
_

MrCoder
18th April 2016, 06:24
Once inside the firefox browser, a click on some links will open in a new tab, the links do not open in WebView

anda_skoa
18th April 2016, 09:29
How would Firefox know that you want to open links in your program?

Cheers,
_

MrCoder
18th April 2016, 15:34
No, I open a site on Firefox when I click on the links it will open in another window
now, when the site opens in WebView, and I could not open the link I click on the links

anda_skoa
18th April 2016, 16:44
I see.
Have you checked if onNavigationRequested is invoked for those links?

Btw, if you are developing something new, you might want to look into Qt5.6 and WebEngineView

Cheers,
_

MrCoder
19th April 2016, 09:06
Thanking you
all the links that Target is equal to _blank
<a href="" target="_blank">Click here!</a>
Within WebView when I click on this link does not work why?