Click here to Skip to main content
15,843,623 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
Hi , I want to make an WebView application. but I don't know how I'd save pictures, How Can I do? with InvokeScriptAsync?

What I have tried:

Hi , I want to make an WebView application. but I don't know how I'd save pictures, How Can I do? with InvokeScriptAsync?
Updated 21-Jan-17 13:24pm

1 solution

WebView uses the Internet Explorer engine to render the web pages (or Edge in UWP), to get started you can download the sample provided by Microsoft on GitHub: Windows-universal-samples/Samples/WebView at master · Microsoft/Windows-universal-samples · GitHub[^]. You can also learn more about this control at MSDN, WebView class - Windows app development[^].

Now to answer your question, what sort of images do you want to download? As I mentioned, the control is already powered by Internet Explorer (or Edge), and thus you do not need to perform any action and browser will itself provide the basic controls to the users. You mention, InvokeScriptAsync[^], that will do no good as it will require you to write a script in the HTML document and then add the code to download and save the image. Besides, you will be required to handle the JavaScript call from your browser (will IE let that? I am unsure).

Simply, just build the web browser application. If you need to get more control over it, consider reading a bit about Chakra engine that powers JS engine in Edge.

GitHub - Microsoft/ChakraCore: ChakraCore is the core part of the Chakra Javascript engine that powers Microsoft Edge[^]
save image without downloading
Saving the image is performed by downloading the image, either to memory, or to hard drive. Browsers basically load the pages to memory, then to cache them they store them in hard drive if required. So basically, they end up downloading them.
Share this answer
Member 11962171 21-Jan-17 18:49pm    
I don't know how to use chakra. do you have a solution for this?
Afzaal Ahmad Zeeshan 21-Jan-17 19:01pm    
Chakra was a complex concept and feature to work with. Just build a simple application and you will be good to go.

Also in your case, you can see that the error being shown is the security error (which will be access denied problem). And if the internal engine cannot solve that, it means there are some serious issues, modifying the internal procedures won't work at all.
Member 11962171 21-Jan-17 19:34pm    
but unfortunately I don't know the C++ language. i know is c# language.
Member 11962171 21-Jan-17 19:36pm    
and the build error has occurred.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900