javascript - How to dynamically update version number in chrome app? -
javascript - How to dynamically update version number in chrome app? -
i have google chrome packaged app , update version number on app's page based off of manifest file. manifest file so:
manifest.json
{ "manifest_version": 2, "name": "book writer", "version": "2.0.8.0", "icons": { "16": "images/book-icon.png", "48": "images/book-icon.png", "128": "images/book-icon.png" }, "app": { "background": { "scripts": ["main.js"] } }, "permissions": [ "storage", "contextmenus" ] } important part beingness "version": "2.0.8.0",
and page structured so:
about.html
<!doctype html> <head> <title>about</title> <link rel="stylesheet" type="text/css" href="/css/about.css"> </head> <body> <h1 class="main-header">book author v 2.0.8.0</h1> <h2 class="sub-header">this game made by: dragonloverlord</h2> <h2 class="sub-header">license</h2> <div class="license-div"> <code> mit license (mit)<br> <br> copyright (c) 2014 dragonloverlord<br> <br> permission hereby granted, free of charge, person obtaining re-create of software , associated documentation files (the "software"), deal in software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of software, , permit persons whom software furnished so, subject next conditions:<br> <br> above copyright notice , permission notice shall included in copies or substantial portions of software.<br> <br> software provided "as is", without warranty of kind, express or implied, including not limited warranties of merchantability, fitness particular purpose , noninfringement. in no event shall authors or copyright holders liable claim, damages or other liability, whether in action of contract, tort or otherwise, arising from, out of or in connection software or utilize or other dealings in software.<br> </code> </div> </body> </html> if can not update straight manifest file there angularjs csp compliant method update number off of single variable have link script page in app needs version number updated?
you can update straight manifest: chrome.runtime.getmanifest api for.
in pure javascript, this:
document.addeventlistener('domcontentloaded', function () { manifest = chrome.runtime.getmanifest(); document.queryselector('h1.main-header').innerhtml = "book author v " + manifest.version; }); javascript angularjs google-chrome-app
Comments
Post a Comment