This package reads manifest referenced in the current web page.
<link rel="manifest" href="manifest.json">
{
"name": "Google I/O 2015",
"short_name": "I/O 2015",
"start_url": "./?utm_source=web_app_manifest",
"display": "standalone"
"icons": [{
"src": "images/touch/homescreen48.png",
"sizes": "48x48",
"type": "image/png"
}]
}
npm install web-manifest-reader
<script async src="https://cdn.jsdelivr.net/npm/web-manifest-reader@VERSION/lib.js"
Then, you can use it easly.
import Manifest from 'web-manifest-reader';
Manifest.read().then(manifestData => {
console.log('I want the name: '+manifestData.name);
}).catch(error => {
console.log('an error occured', error.message);
});
WebManifestReader.readCallback(function(manifestData, error) {
if (error) {
console.log('An error occurred', error.message);
return;
}
console.log('I want the name: '+manifestData.name);
});