简体   繁体   English

本地存储在一个没有Internet访问的html文件中

[英]local storage in one html file without internet access

I need to store data from some forms in a single html file, and it must be without internet access and only in one file (the own html file of the forms). 我需要将来自某些表单的数据存储在单个html文件中,并且它必须没有Internet访问权限且只能在一个文件中(表单的自己的html文件)。

The perfect solution would be jstorage but it doesn´t work in IE9 or IE8 without a web server, I was searching for a tiny web server i could include in the html file but it is impossible I think, because the solution must be invisible for the customer and all the tiny web server i found needs a installation or some kind of configuration... 完美的解决方案是jstorage,但它不能在没有Web服务器的IE9或IE8中工作,我正在搜索一个小的Web服务器,我可以包含在html文件中,但我认为这是不可能的,因为解决方案必须是隐形的客户和我发现的所有小型Web服务器都需要安装或某种配置......

I can not use cookies or some extra file, only the file with the forms. 我不能使用cookie或一些额外的文件,只能使用带有表单的文件。

Please someone could give me some help? 请有人给我一些帮助吗? At least i need a idea to find the solucion. 至少我需要一个想法来找到解决方案。

Thank you very much. 非常感谢你。

If you're trying to create a single transportable HTML-like file with images, javascript, CSS, etc. all embedded as multiple "files" then you can try MHTML , which lets you store data of different MIME types in a single file. 如果您正在尝试使用图像,javascript,CSS等创建单个可传输HTML类文件,所有文件都嵌入为多个“文件”,那么您可以尝试使用MHTML ,它允许您将不同MIME类型的数据存储在单个文件中。

It's been supported by IE for some time now, though from experience I can tell you it's somewhat clunky to store, view, and use the files. 它已经被IE支持了一段时间了,不过根据经验我可以告诉你存储,查看和使用文件有点笨拙。 Generating MHTML programmatically is not too bad though. 以编程方式生成MHTML并不算太糟糕。 You basically just create a text file in the specified format and give it a .mht extension, which IE will recognize. 你基本上只是创建一个指定格式的文本文件,并给它一个.mht扩展名,IE将识别。 URLs can be used to reference and label the different parts (say for including an image in an HTML part), and binary content is stored as base64 encoded text. URL可用于引用和标记不同的部分(例如,在HTML部分中包含图像),二进制内容存储为base64编码的文本。

Microsoft has a decent example , showing an email message with embedded images, to get you started. 微软有一个很好的例子 ,显示带有嵌入式图像的电子邮件,以帮助您入门。

From: example1@example.com
To: example2@example.com
Subject: An example
Mime-Version: 1.0
Content-Base: http://server.example.com
Content-Type: Multipart/related; boundary="boundary-example-1";type=Text/HTML

--boundary-example-1
Content-Type: Text/HTML; charset=ISO-8859-1
Content-Transfer-Encoding: QUOTED-PRINTABLE

... text of the HTML document, which might contain a hyperlink
to the other body part, for example through a statement such as:
<IMG SRC="/images/image.gif" ALT="Image">
Example of a copyright sign encoded with Quoted-Printable: =A9
Example of a copyright sign mapped onto HTML markup: &#168;

--boundary-example-1
Content-Location: /images/image.gif
Content-Type: IMAGE/GIF
Content-Transfer-Encoding: BASE64

AAAFFDDlhGAGgAPEAAP/////ZRaCgoAAAACH+PUNvcHlyaWdodCAoQykgMTk5
NSBJRVRGLiBVbmF1dGhvcml6ZWQgZHVwbGljYXRpb24gcHJvaGliaXRlZC4A
etc...

--boundary-example-1 — 

If by "without internet access", you mean developing locally, I think the best thing to do is to install a Program that will allow you to do so. 如果通过“没有互联网访问”,你的意思是在本地开发,我认为最好的办法是安装一个允许你这样做的程序。 XAMPP offers a great package of programs to assist you with that. XAMPP提供了一系列精彩的程序来帮助您。 From developing PHP files that work good with getting data from HTML forms. 从开发适用于从HTML表单获取数据的PHP文件。 You can download XAMPP here: http://www.apachefriends.org/en/xampp-windows.html 你可以在这里下载XAMPP: http//www.apachefriends.org/en/xampp-windows.html

Make sure to do some research on how to install XAMPP in order to develop locally, but I can promise you one thing. 一定要做一些关于如何安装XAMPP以便在本地开发的研究,但我可以向你保证一件事。 It's simple and easy to install and start working on... 它简单易用,安装并开始工作......

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

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