WebView hyperlinks

358
3
04-13-2022 12:37 PM
RyanGay
New Contributor II

I have incorporated the WebView into my app to view other reference pages, but I have a couple of issues. One is the fact that hyperlinks will not work and a user cannot download files from this webview. What is the fix for this? 

0 Kudos
3 Replies
TrevorFrame
Esri Contributor

Hi @RyanGay ,

There is no direct way of downloading files using the WebView component. In order to download files you can use the NetworkRequest component within the AppFramework. This allows for transfer of data and can be used to download files. A good example of this can be seen in the Map Viewer template MapViewer/controls/MmpkManager.qml file. If you still want this done via the WebView component, you can set a signal handler onUrlChanged and set some conditional logic so if it recognizes the url that's supposed to download the file, you can call the network request from there. 

Hope this helps. 

-Trevor

0 Kudos
RyanGay
New Contributor II

@TrevorFrame thanks for the info. Would using the Qt WebEngine instead of WebView work as well?

0 Kudos
TrevorFrame
Esri Contributor

You can use the WebEngineView component as well. 

0 Kudos