Edit and save a file locally with JS

前端 未结 3 665
鱼传尺愫
鱼传尺愫 2020-12-19 14:09

I don\'t know if it\'s possible but here\'s what I would like to achieve. I would want to be able to load a JSON file using a file input, edit it in a web page and then save

3条回答
  •  抹茶落季
    2020-12-19 15:01

    Locale storage? Stores key value pairs that will persist -variable limitations across browsers, but the general idea is supported by Chrome, Firefox, Safari, Opera, IE. Things are stored as strings, so you could store json type information as a value, rather than breaking your json into lots of key/value items.

    This is not the most secure way of doing this, but would probably be fine for preferences and even application state, if you don't mind there being a potential for something client side to tweak values.

    If a user wants to save this, then you invoke the download/save file option.

提交回复
热议问题