Reputation: 11433
I have a chrome extension which have a server-side javascript and I need this js to be reloaded every [1] hour on the client side. What´s the best way to do it?
Upvotes: 1
Views: 12848
Reputation: 349042
Method 1
Bump your extension version every couple of hours. Chrome will automatically update the extension: http://code.google.com/chrome/extensions/autoupdate.html.
Method 2, distinguishing cases:
setInterval
in the background page to regularly update the variables. Do not forget to set the permissions in manifest.json
, to enable cross-origin XHR.JSON.parse
.<script>
tags in the background page.Warning: Loading and executing external scripts in the background page poses a potential security hole in the extension.
When the network connection or your server is compromised, an evil third party can execute arbitrary code with your extension's privileges!
Upvotes: 3
Reputation: 4026
Ask your question in more clear way. As far as i understand you want to update the js-code on client-side every hour. If so, you can't do this in chrome extensions.
Upvotes: 1