How to read a properties file in javascript from project directory?

前端 未结 5 1435
你的背包
你的背包 2020-12-05 15:23

I\'m building a Chrome Packaged App. I want to put the script configuration if a config file in a resource directory and on startup want to read that by Javascript.

5条回答
  •  粉色の甜心
    2020-12-05 16:09

    Structure the file as JSON. Read it into a string using the File API or XHR. Then JSON.parse(string).

    • Loading local content through XHR in a Chrome packaged app
    • http://blog.teamtreehouse.com/reading-files-using-the-html5-filereader-api

提交回复
热议问题