admin管理员组文章数量:1026989
My question is quite simple, i need to develop a Google Chrome Extension and by the way create dynamically HTML/CSS files. Basically i was thinking to do this with javascript but it's not possible for security reason. So i'm thinking about using directly Chrome API.
Is there a persistance API with chrome ?
My question is quite simple, i need to develop a Google Chrome Extension and by the way create dynamically HTML/CSS files. Basically i was thinking to do this with javascript but it's not possible for security reason. So i'm thinking about using directly Chrome API.
Is there a persistance API with chrome ?
Share Improve this question edited Oct 7, 2012 at 19:07 vurquee 4911 gold badge7 silver badges20 bronze badges asked Mar 8, 2011 at 15:04 SindarSindar 10.9k7 gold badges34 silver badges45 bronze badges 5- 2 Question may be simple, but I don't really get what you're asking... – Bart Commented Mar 8, 2011 at 15:13
- I don't understand "it's not possible for javascript reason." why is it not possible? Google Chrome API for extensions must be consumed using javascript. – apose Commented Mar 8, 2011 at 15:14
- Sorry i've edited the post... The question is just that i wan't to know how i can write a file... Using Chrome API, HTML5, js, jquery ? What's the best possibility... – Sindar Commented Mar 8, 2011 at 15:15
- I don't know if it this is pletely what you need but it is worth a look: robertnyman./2010/04/22/… – apose Commented Mar 8, 2011 at 15:28
- 1 Could you please explain in more details why do you need this and what kind of task are you solving. – serg Commented Mar 8, 2011 at 17:07
3 Answers
Reset to default 2Chrome Extensions use localStorage for data persistence. Check out http://diveintohtml5.ep.io/storage.html for a tutorial.
Note that only strings can be saved to localStorage. You'll need a JSON parser/stringifier if you want to load/save objects.
It is possible to do this with javascript. Chrome is very strict when it es to calling scripts outside its domain(your extension folder I mean). 1. Make sure you are making js calls from your background page and not your content scripts. 2. If you are making js/ajax calls, note that chrome always sends an OPTIONS request. even for GET requests. So your server have to be able to grant permisions.
I hope these 2 points help your js. However, as everyone is saying, LocalStorage does a really good job.
I'm not pletely sure of what you are asking but take a look at Local Storage
Hope it helps!
My question is quite simple, i need to develop a Google Chrome Extension and by the way create dynamically HTML/CSS files. Basically i was thinking to do this with javascript but it's not possible for security reason. So i'm thinking about using directly Chrome API.
Is there a persistance API with chrome ?
My question is quite simple, i need to develop a Google Chrome Extension and by the way create dynamically HTML/CSS files. Basically i was thinking to do this with javascript but it's not possible for security reason. So i'm thinking about using directly Chrome API.
Is there a persistance API with chrome ?
Share Improve this question edited Oct 7, 2012 at 19:07 vurquee 4911 gold badge7 silver badges20 bronze badges asked Mar 8, 2011 at 15:04 SindarSindar 10.9k7 gold badges34 silver badges45 bronze badges 5- 2 Question may be simple, but I don't really get what you're asking... – Bart Commented Mar 8, 2011 at 15:13
- I don't understand "it's not possible for javascript reason." why is it not possible? Google Chrome API for extensions must be consumed using javascript. – apose Commented Mar 8, 2011 at 15:14
- Sorry i've edited the post... The question is just that i wan't to know how i can write a file... Using Chrome API, HTML5, js, jquery ? What's the best possibility... – Sindar Commented Mar 8, 2011 at 15:15
- I don't know if it this is pletely what you need but it is worth a look: robertnyman./2010/04/22/… – apose Commented Mar 8, 2011 at 15:28
- 1 Could you please explain in more details why do you need this and what kind of task are you solving. – serg Commented Mar 8, 2011 at 17:07
3 Answers
Reset to default 2Chrome Extensions use localStorage for data persistence. Check out http://diveintohtml5.ep.io/storage.html for a tutorial.
Note that only strings can be saved to localStorage. You'll need a JSON parser/stringifier if you want to load/save objects.
It is possible to do this with javascript. Chrome is very strict when it es to calling scripts outside its domain(your extension folder I mean). 1. Make sure you are making js calls from your background page and not your content scripts. 2. If you are making js/ajax calls, note that chrome always sends an OPTIONS request. even for GET requests. So your server have to be able to grant permisions.
I hope these 2 points help your js. However, as everyone is saying, LocalStorage does a really good job.
I'm not pletely sure of what you are asking but take a look at Local Storage
Hope it helps!
本文标签: javascriptGoogle Chrome Extension PersistenceStack Overflow
版权声明:本文标题:javascript - Google Chrome Extension Persistence - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745669707a2162388.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论