简体   繁体   中英

How can I save a client-side only webpage with text inputs?

I have made a simple webpage with a Javascript backend. I want the user to be able to enter in a bunch of data in form fields, and then save the page. PDF, HTML, doesn't matter, I just want to be able to save the page WITH all of the user's data.

This has to be client side only, I don't want people to have to setup a server just to use it.

The browser's security mechanism does not allow you to create files barring cookies. So may want to google JavaScript cookies and how to use them.

Have two pages, on your first present the form and submit it to the second page using (keep the method get:

<form action="second_page.html" method="GET"> <!-- Other stuff --> </form>

GET will send data as a part of the URL to the second page.

On the second page parse the URL to get the variables set by the user, you can use something like this . Use DHTML/JavaScript to display the values thus fetched into the format you may wish.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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