UWP webview保存图像而无需下载 [英] UWP webview save image without downloading

查看:78
本文介绍了UWP webview保存图像而无需下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个WebView应用程序。但我不知道如何保存图片,我该怎么办?使用InvokeScriptAsync?



我尝试过:



我想要制作一个WebView应用程序。但我不知道如何保存图片,我该怎么办?使用InvokeScriptAsync?

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?

推荐答案

WebView使用Internet Explorer引擎呈现网页(或UWP中的Edge),开始时可以下载Microsoft提供的示例GitHub: Windows-universal-samples / Samples / WebView at master·Microsoft / Windows-universal-样本·GitHub [ ^ 。您还可以在MSDN上了解有关此控件的更多信息, WebView class - Windows应用程序开发 [ ^ ]。



现在回答你的问题,你想下载什么样的图像?正如我所提到的,控件已经由Internet Explorer(或Edge)提供支持,因此您无需执行任何操作,浏览器本身也会为用户提供基本控件。你提到, InvokeScriptAsync [ ^ ],这将不会有任何好处,因为它将要求您在HTML文档中编写脚本,然后添加代码以下载并保存图像。此外,您将被要求从您的浏览器处理JavaScript调用(IE会允许吗?我不确定)。



简单地说,只需构建Web浏览器应用程序即可。如果你需要对它进行更多的控制,可以考虑阅读一下有关Chakra引擎的信息,它可以为Edge中的JS引擎提供动力。



GitHub - Microsoft / ChakraCore:ChakraCore是Chakra Javascript引擎的核心部分为Microsoft Edge提供动力 [ ^ ]

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[^]
引用:

保存图像而不下载

通过将图像下载到内存或硬盘驱动器来保存图像。浏览器基本上将页面加载到内存,然后缓存它们,如果需要,它们将它们存储在硬盘驱动器中。基本上,他们最终会下载它们。

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.


这篇关于UWP webview保存图像而无需下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆