web-manifest-reader
TypeScript icon, indicating that this package has built-in type declarations

1.2.3 • Public • Published

web-manifest-reader

npm GitHub file size in bytes npm

This package reads manifest referenced in the current web page.

Your web manifest

<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"
  }]
}

Get started

With npm

npm install web-manifest-reader

Otherwise

<script async src="https://cdn.jsdelivr.net/npm/web-manifest-reader@VERSION/lib.js"

Then, you can use it easly.

With ES6 module

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);
});

Without ES6 module

WebManifestReader.readCallback(function(manifestData, error) {
    if (error) {
        console.log('An error occurred', error.message);
        return;
    }
 
    console.log('I want the name: '+manifestData.name);
});

Readme

Keywords

Package Sidebar

Install

npm i web-manifest-reader

Weekly Downloads

98

Version

1.2.3

License

ISC

Unpacked Size

13.5 kB

Total Files

10

Last publish

Collaborators

  • adpeyre