How can I create a file for storage on the client side with JavaScript?

前端 未结 7 807
独厮守ぢ
独厮守ぢ 2020-12-03 18:35

I need to create a temporary file to store user settings on the client side. Is it possible to create a simple log file using JavaScript?

7条回答
  •  攒了一身酷
    2020-12-03 19:14

    If you want to store user settings, you should:

    1. use cookies
    2. store client information on the server

    The ability for a webpage to access an individual's hard disk would be hazardous. However, as Trey pointed out below, you can use:

    • HTML 5 Client Side Storage (browser support still limited)
    • ActiveX/FileSystemObject (Windows/IE only)

提交回复
热议问题