简体   繁体   English

ipad web app加载本地图像

[英]ipad web app load local image

Can a web app load an image from it's local store onto the webpage? Web应用可以将图像从本地商店加载到网页上吗?

Thanks 谢谢

What do you mean by "local store"? 你对“本地商店”是什么意思?

If you mean the HTML5 applicationCache, then yes, any images that are in the applicationCache are available for use online or offline. 如果您的意思是HTML5 applicationCache,那么是的,applicationCache中的任何图像都可以在线或离线使用。

If you mean from the Web SQL database or the localStorage API, then yes, but the images must be base64-encoded as text and then loaded as data URLs. 如果您的意思是来自Web SQL数据库或localStorage API,那么是,但图像必须以文本的形式进行base64编码,然后作为数据URL加载。

If you mean the photos in the user's personal collection on a mobile device or computer, then no, that's not possible. 如果您指的是移动设备或计算机上用户个人收藏中的照片,那么不,这是不可能的。

Use a manifest file. 使用清单文件。 Google it. 谷歌一下。

It's 2 lines of code and you need to declare it in your .htaccess file 它是2行代码,您需要在.htaccess文件中声明它

I should think not, as it can open vulnerable security risk: 我不应该这么想,因为它可以打开易受攻击的安全风险:

  • If a web app can load an image from local storage, it means that there's a facility to browse local storage device (either via the browser JS engine or the web app). 如果Web应用程序可以从本地存储加载图像,则意味着可以浏览本地存储设备(通过浏览器JS引擎或Web应用程序)。 The malicious attacker can use this to gain valuable user information. 恶意攻击者可以使用它来获取有价值的用户信息。
  • If the image could be loaded, what will be the path of the image? 如果可以加载图像,图像的路径是什么? And if this path is valid, can every user viewing your web application open the image? 如果此路径有效,那么查看您的Web应用程序的每个用户都可以打开图像吗?

iPad doesn't have a storage directory like a PC (ie directory structure, eg home/user/* structure). iPad没有像PC这样的存储目录(即目录结构,例如home/user/*结构)。 Each application can store data that is only visible to the application (unless the application can allow sharing). 每个应用程序都可以存储仅对应用程序可见的数据(除非应用程序允许共享)。

It's better to store image on server machine and load images from there. 最好将图像存储在服务器计算机上并从那里加载图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM