<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Subodh Garg on Medium]]></title>
        <description><![CDATA[Stories by Subodh Garg on Medium]]></description>
        <link>https://medium.com/@subodhgarg?source=rss-71c2dc02efb0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*wiuGpGYCuxLErkHi.</url>
            <title>Stories by Subodh Garg on Medium</title>
            <link>https://medium.com/@subodhgarg?source=rss-71c2dc02efb0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 13:55:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@subodhgarg/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Set up Vue.js project in 5 easy steps using vue-cli]]></title>
            <link>https://medium.com/@subodhgarg/how-to-set-up-vue-js-project-in-5-easy-steps-using-vue-cli-669b1aea518b?source=rss-71c2dc02efb0------2</link>
            <guid isPermaLink="false">https://medium.com/p/669b1aea518b</guid>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[vue-cli]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[framework]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Subodh Garg]]></dc:creator>
            <pubDate>Sat, 13 Jan 2018 19:06:32 GMT</pubDate>
            <atom:updated>2018-01-13T19:06:32.959Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HVhbb7dbGzpPL2gtNXKVCg.jpeg" /></figure><p>I just started learning about <a href="https://vuejs.org/">Vue.js</a> and is intrigued by the simplicity of this javascript framework. And this was my first reaction…</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FNnGGHE0muVqpO%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FNnGGHE0muVqpO%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FNnGGHE0muVqpO%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="360" frameborder="0" scrolling="no"><a href="https://medium.com/media/47949df796095bfb913329b40ce2b9bf/href">https://medium.com/media/47949df796095bfb913329b40ce2b9bf/href</a></iframe><p>Yes, just type following 5 commands in your terminal one after another, and you are done(if you have <a href="https://nodejs.org/en/">node.js</a> installed).</p><p><strong>Step 1</strong></p><pre>npm install -g vue-cli</pre><p>This command will install vue-cli globally. Think of it like buying a tool, which you purchase once(free in our case) and can use it any number of times. So for setting up another project from next time, this command is not required. So number of steps for setting up any new project is actually 4!</p><p><strong>Step 2</strong></p><pre>Syntax: vue init &lt;template-name&gt; &lt;project-name&gt;<br>example: vue init webpack-simple new-project</pre><p>The above command pulls a webpack template, prompts for some information and generate a project in directory/folder new-project</p><p>You can choose from various templates(simple, webpack, pwa etc.) from <a href="https://github.com/vuejs/vue-cli"><strong>here</strong></a><strong>.</strong></p><p>And the most interesting part is, this is the only command you need to know, because next 3 commands will be shown to you in the command line(see below) after completing this step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*n2Bsmc-pv59hIRGeymUsSg.png" /></figure><p><strong>Step 3</strong></p><pre>cd new-project</pre><p>Change directory to your project folder</p><p><strong>Step 4</strong></p><pre>npm install</pre><p>Install all the dependencies required by the template as listed in package.json file. This step may take a minute or two to get all the dependencies.</p><p><strong>Step 5</strong></p><pre>npm run dev</pre><p>This command will start your local http server, open the browser and your default hosted web page will be shown.</p><p>Congrats! your project is ready to use.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=669b1aea518b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build Chrome Extension with AngularJS & Google’s Natural Language API]]></title>
            <link>https://medium.com/@subodhgarg/how-to-build-chrome-extension-with-angularjs-googles-natural-language-api-370f9a4953e?source=rss-71c2dc02efb0------2</link>
            <guid isPermaLink="false">https://medium.com/p/370f9a4953e</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[chrome-extension]]></category>
            <category><![CDATA[chrome]]></category>
            <category><![CDATA[angularjs]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Subodh Garg]]></dc:creator>
            <pubDate>Mon, 08 Jan 2018 20:03:17 GMT</pubDate>
            <atom:updated>2018-01-12T17:07:08.355Z</atom:updated>
            <content:encoded><![CDATA[<p>Chrome extensions are like <em>dragons</em> of <em>Game Of Thrones</em> in web world. You won’t see them much, but when you do… Oh boy! They takes your breath away.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*bDbXLnV2VOuVR13Uk-SnAA.jpeg" /></figure><p>I was using many chrome extensions like <em>Ads Block Plus</em>, <em>EverNote</em>, <em>Angular watchers</em>, <em>Motivate</em> etc. from so long and being a web developer was always amazed by the power these small software packages possess.</p><p>So I tried to give it a spin myself and to my surprise I didn’t have to learn much to create something of my own.</p><p>Just learned some basic concepts of how chrome extension works and mixed it with my prior knowledge of basic HTML, CSS, Javascript and AngularJS. And what I got is this -&gt; <a href="https://chrome.google.com/webstore/detail/text-sentiment-analysis/bhjikdhhfnicmnchfcnogdfifchjjgmn"><strong><em>Text Sentiment Analysis</em></strong></a><em> chrome extension</em>.</p><p>An amazing(silly! actually :D) chrome extension which can analyze sentiment of selected text on any web page using Google’s Natural Language(NL) API. See below screenshots to understand how it works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dQzNQ3rrmfjiptLGCeT7QA.jpeg" /><figcaption>Select some text on any web page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZZi-kbXbgKrEzYFFG6SMvw.jpeg" /><figcaption>Click the extension button in browser bar</figcaption></figure><blockquote><strong>Fetch the code</strong> of the above extension from this <a href="https://github.com/Subodh-Garg/Text-Sentiment-Analysis-Chrome-Extension"><strong>Github repo</strong></a> and follow along.</blockquote><p>For above code to work, you have to insert your project’s API_KEY in popup.js file. Don’t worry, we will discuss how to create your own project key later in this post.</p><p>If I am not wrong, You all might be screaming this by now…</p><blockquote>Hey! We got that chrome extensions are fun and powerful but we still don’t know how to build chrome extension with AngularJS and NL API.</blockquote><p>Please bear with me for few more minutes and I promise you won’t regret it.</p><p>So, let’s take it step by step(4 to be precise)…</p><h3>1. What is a Chrome Extension?</h3><p>Some basics are needed at this point. Chrome extensions are tiny web applications(consists of HTML, CSS and Javascript) which when added to chrome lives in your browser and uses some special chrome API’s to enhance your browsing experience or solves any particular use case.</p><p>The resources I mentioned at the end of this post, answers this question in a much better way.</p><h3><strong>2. How does it work?</strong></h3><p>This is a simple yet powerful question. Once understood properly will open doors for multiple opportunities.</p><p>Someone told me : “<em>A picture is worth a thousand words”</em></p><p>So, here is my version for understanding how chrome extension works(these are just rough sketches)…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xGyYsrXGdTi1W4DkUPVQ5A.jpeg" /><figcaption>Overview Of Chrome Extension Entities</figcaption></figure><p><strong>Key Points</strong></p><ul><li>Main Entities of chrome Extensions are <em>manifest.json</em>, <em>content.js</em>, <em>background.js</em> and <em>Popup.</em></li><li>Each one of these entities :- content.js, background.js and popup have their own isolated scopes and dev tool windows for debugging.</li><li>Only content.js have access to the DOM of the current web page directly.</li><li>All these elements interact with each other by sending and listening to events provided by chrome API.</li></ul><p>Refer to blogs and tutorials at the end of this post for further details.</p><blockquote>Now lets see how our <strong>Text Sentiment Analysis</strong> extension works with respect to above mentioned components.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YLrbz3nJ69T4abfA1eCO5g.jpeg" /><figcaption>Text Sentiment Analysis Chrome Extension Overview</figcaption></figure><h3>3. How to include AngularJS?</h3><p>It is same as you include AngularJS in any other web project.</p><p>Download the minified version of the framework from <a href="https://code.angularjs.org/1.6.5/">here</a> and link it from popup.html file as you would do it in index.html for any other AngularJS project(Refer <a href="https://github.com/Subodh-Garg/Text-Sentiment-Analysis-Chrome-Extension">code</a>).</p><h3><strong>4. How to include Natural Language API?</strong></h3><p>It is as simple as using any other third party API in your web project.</p><p>(i) First create a Google Cloud Project to generate your own API key . Follow instructions given on <a href="https://support.google.com/cloud/answer/6158862?hl=en">this</a> official page.</p><p>(ii) Next enable Natural Language API to use in your project from <a href="https://console.cloud.google.com/apis/library/language.googleapis.com/">here</a>.</p><p>(iii) Start making POST calls as follows from your custom javascript code(popup.js in our case).</p><pre>$http({<br>          url: &#39;<a href="https://language.googleapis.com/v1/documents:analyzeSentiment?key=YOUR_API_KEY&#39;">https://language.googleapis.com/v1/documents:analyzeSentiment?key=YOUR_API_KEY&#39;</a>,<br>          method: &quot;POST&quot;,<br>          data: {<br>            &quot;encodingType&quot;: &quot;UTF8&quot;,<br>            &quot;document&quot;: {<br>              &quot;type&quot;: &quot;PLAIN_TEXT&quot;,<br>              &quot;content&quot;: &quot;The text for analysis comes here.&quot;<br>            }<br>          }<br>      })</pre><p>Refer the <a href="https://cloud.google.com/natural-language/docs/analyzing-sentiment">official Google docs</a> to understand how this API works and overall structure of the response.</p><p>We are using top level ‘score’ property as a parameter to display overall sentiment of the selected text. -ve value means negative sentiment, +ve for positive and 0 for neutral sentiment.</p><blockquote>Hurray! You have learned how to create your own chrome extension and include an advanced Machine Learning API.</blockquote><p>Check out Google’s official document page for more <a href="https://cloud.google.com/products/machine-learning/">Machine Learning API’s</a>.</p><p>Thank you for reading this far. I hope this new combined skill set of Chrome extension and Google’s machine learning API’s will open some new doors of creativity for you.</p><p>Please don’t forget to give some claps if you like this post. Happy Learning :)</p><p><strong>Resources</strong></p><ul><li><a href="https://www.youtube.com/watch?v=hkOTAmmuv_4&amp;list=PLRqwX-V7Uu6bL9VOMT65ahNEri9uqLWfS">Chrome Extension Youtube tutorial playlist</a> —<em> I loved these tutorials.</em></li><li><a href="https://medium.com/@aidobreen/building-a-simple-chrome-extension-1b8a0fca3ca6">Building a simple chrome extension</a></li><li><a href="https://www.sitepoint.com/create-chrome-extension-10-minutes-flat/">How to create chome extension in 10 minutes flat</a></li><li><a href="https://medium.com/@LindaHaviv/the-beginner-s-guide-build-a-simple-chrome-extension-in-minutes-498308ea406a">Build a simple chrome extension in minutes</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=370f9a4953e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web App Manifest File— Make your web app Installable]]></title>
            <link>https://medium.com/@subodhgarg/web-app-manifest-file-make-your-web-app-installable-b5fcdb2919b9?source=rss-71c2dc02efb0------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5fcdb2919b9</guid>
            <category><![CDATA[web-app-manifest]]></category>
            <category><![CDATA[pwa]]></category>
            <category><![CDATA[web-apps]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[web-app-development]]></category>
            <dc:creator><![CDATA[Subodh Garg]]></dc:creator>
            <pubDate>Thu, 19 Oct 2017 19:49:24 GMT</pubDate>
            <atom:updated>2017-12-13T21:32:38.362Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*49yd-bsNUObo-eNKuIOzpw.jpeg" /></figure><p><strong>User</strong> attention is the key to success. Whether you want to sell a product, service or share your crazy new idea with the world.</p><p>And what do I mean by user? I mean “we”, <em>humans</em>. And we all know where we spend most of our time. Yes, you guessed it right. It is that small little thing in your back pocket that lets you do multiple things in one shot. Whether it is taking a selfie, connecting to the world, buy a new dress or zillion other things you do in your day to day life.</p><p>So, it is very important to have a strong presence on mobile devices, whether you achieve it by native mobile apps(android/iOS) or by creating a PWA. Those of you don’t know, what PWA is? It stands for <strong>Progressive Web Apps</strong>. These are the web applications which are build using some latest web technologies <em>or</em></p><p>as <em>Alex Russell</em> says</p><blockquote>“PWA are websites that have taken all the right Vitamins”</blockquote><p>So 1 such right vitamin is <strong>Web App Manifest File</strong>. It is a json text file which contains information about your web application and when combined with a <strong>Service Worker </strong>can install web app on your device.</p><p>If it doesn’t make sense to you, no problem! It didn’t made for me also when I first heard this :D</p><p>You can go through following three <strong>videos</strong> or <strong>live</strong> <strong>demo links</strong>(in caption) and check how the same web application behave on mobile devices with little changes:</p><blockquote>1. With neither Manifest file nor Service Worker</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FA_GJBufqkCM%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DA_GJBufqkCM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FA_GJBufqkCM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/93f316ff622209d17c23834d2ad1f02b/href">https://medium.com/media/93f316ff622209d17c23834d2ad1f02b/href</a></iframe><blockquote>2. With Manifest file but without Service Worker</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F1hvk-wP8q9M%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1hvk-wP8q9M&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F1hvk-wP8q9M%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/67aca97f16ed94441993188290fc4e2f/href">https://medium.com/media/67aca97f16ed94441993188290fc4e2f/href</a></iframe><blockquote>3. With both Manifest file and Service Worker</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FwpsgYSO8o5s%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DwpsgYSO8o5s&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FwpsgYSO8o5s%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2cbd1dd10135b13fad14404184d4de79/href">https://medium.com/media/2cbd1dd10135b13fad14404184d4de79/href</a></iframe><p>So, now tell me frankly! Which experience you would love to give to your users? I like experience <strong>#3 </strong>and<strong> </strong>If I am not wrong, most of you would also choose number 3. So let’s learn next how we can achieve this.</p><blockquote><em>A spoiler Alert</em> — It is damn easy!</blockquote><p>By now you would have guessed, we need 2 things to make our web app Installable.</p><ol><li><strong>Web App Manifest file</strong></li><li><strong>Service Worker</strong></li></ol><p>Let’s take it 1 by 1…</p><h3>App Manifest File (5 steps including validation and testing)</h3><ol><li><strong>Create a manifest.json file</strong> as shown below in the same directory where your index.html is present.</li></ol><pre><strong>{<br>&quot;name&quot;: &quot;Only Manifest&quot;,</strong><br><strong>&quot;short_name: &quot;only_manifest&quot;,<br>&quot;description&quot;: &quot;dummy application to demo manifest without SW&quot;,</strong><br><strong>&quot;start_url&quot;: &quot;/index.html&quot;,</strong><br><strong>&quot;scope: &quot;.&quot;,<br>&quot;background_color&quot;: &quot;#EEE&quot;,<br>&quot;theme_color&quot;: &quot;#4A148C&quot;,<br>&quot;display&quot;: &quot;standalone&quot;,<br>&quot;orientation&quot;: &quot;portrait-primary&quot;,<br>&quot;dir: &quot;ltr&quot;,<br>&quot;lang&quot;: &quot;en-US&quot;,<br>&quot;related_applications: [<br>  {<br>     &quot;platform&quot;: &quot;play&quot;,<br>     &quot;url&quot;: &quot;https://play.google.com/.../app_name&quot;,<br>     &quot;id&quot;: &quot;com.example.app&quot;<br>  }<br> ],<br>&quot;icons&quot;: [<br>  {<br>    &quot;src&quot;: &quot;src/images/icons/app-icon-144x144.png&quot;,<br>    &quot;type&quot;: &quot;image/png&quot;,<br>    &quot;sizes&quot;: &quot;144x144&quot;<br>  },</strong><br>  .<br>  .    -&gt; Other similar image objects<br>  .<br> <strong>]<br>}</strong></pre><p>Here is a brief explanation of each property. For more details and option check this <a href="https://developer.mozilla.org/en-US/docs/Web/Manifest">link</a></p><ul><li>name — shows on splash screen.</li><li>short_name — shows on home screen below app icon as app name.</li><li>description — A general description of what web app does.</li><li>start_url — URL that loads first when application is launched by pressing app icon on home screen.</li><li>scope — pages you want to include in your PWA experience, “.” means everything from where I(web app manifest file) is placed. So better put in root directory along with index.html if you want to include full web app.</li><li>background_color — splash screen color.</li><li>theme_color — status bar color.</li><li>display — specifies display mode. ‘Standalone’ means app like i.e. without browser address bar. Other options : ‘fullscreen’, ‘standalone’, ‘minimal-ui’, ‘browser’.</li><li>orientation — specifies screen’s display orientation. ‘portrait-primary’ means strict to portrait mode and prohibits landscape mode. Other options : landscape, any, portrait etc.</li><li>dir — primary text direction. ‘ltr’(default) means left to right.</li><li>lang — primary application language. ‘en-US’(default).</li><li>related_applications — link to related native app(android app). Omit if native app not present.</li><li>icons — array of image objects which contains different sizes of icon you want to show on home screen. Recommended sizes : 48, 96, 144, 192, 256, 384, 512. Your device will choose the best icon automatically.</li></ul><p>2. Next hurdle a person faces is <strong>from</strong> <strong><em>where to get icons?</em></strong> and <strong><em>how to get different sizes of that icon?</em></strong> Don’t worry! we got everything covered. I personally like following 2 places to get and create icons quickly for my project.</p><ul><li><a href="https://www.flaticon.com/"><strong>FlatIcon</strong></a> — They have wide range of vector icons for free.</li><li><a href="https://app-manifest.firebaseapp.com/"><strong>Web App Manifest Generator</strong></a> — You can use this web app manifest generator to both create your manifest file and generate different sized icon. I like to use it for just creating icons as it does not contain all the manifest properties.</li></ul><p>You can alternatively choose to create your own pixel perfect icons using any image-editing software like Photoshop, Illustrator, Sketch etc.</p><p>3. Congrats! you have created your first web app manifest file. Now is the time to check if it is correct or not. <a href="https://manifest-validator.appspot.com/"><strong>Web Manifest Validator</strong></a> is here to help us for <strong>validating the manifest file</strong>.</p><p>4. <strong>Attach manifest file to index.html</strong> using the link tag. Put following code(example) in your head tag.</p><pre>Syntax: &lt;link rel=&quot;manifest&quot; href=&quot;path_to_manifest/manifest.json&quot;&gt;</pre><pre>Example: &lt;link rel=&quot;manifest&quot; href=&quot;/manifest.json&quot;&gt;</pre><p>5. <strong>Let’s</strong> <strong>see it in action</strong>…Open your application in chrome browser -&gt; open dev tools(ctrl + shift + I) -&gt; Application tab -&gt; Manifest</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*buiLTPxYfqf_VN0SwTLfzw.png" /><figcaption>Web App Manifest File</figcaption></figure><blockquote>Hurray! First part is done, let’s move on to 2’nd</blockquote><h3>Register Service Worker (4 steps including both testing on desktop and mobile devices)</h3><p>Service Worker lies at the heart of many PWA features like Offline caching, Background sync, Web push notifications and many more.</p><p>Let’s see how it can help us to add our web app to mobile homescreen.</p><ol><li><strong>Create a Service Worker(a javascript) file</strong> in your root directory. You can name it anything. <em>eg</em> sw.js and put down the following code.</li></ol><pre>self.addEventListener(&#39;fetch&#39;, function(event){<br>});</pre><p>This code is necessary as we have created a very basic service worker file which does nothing. A fetch event above fools browser that our application is offline capable.</p><p>In absence of above code, your service worker will get registered but web app install banner won’t show up. Instead you will see the following error message in your console…</p><p><em>“Site cannot be installed: the page does not work offline”</em></p><p>2. We have just created a service worker file, <strong>let’s register it</strong>. Put the following code in a .js file(not in above service worker file, some other file) which you are sure will be executed or inline in index.html between &lt;script&gt; tag. Earlier it runs, better it is.</p><pre>if(&#39;serviceWorker&#39; in navigator) {<br>  navigator.serviceWorker<br>  .register(&#39;../sw.js&#39;)<br>  .then(function() {<br>    console.log(&quot;Service Worker registered successfully&quot;);<br>  })<br>  .catch(function() {<br>    console.log(&quot;Service worker registration failed&quot;)<br>  });<br>}</pre><p>Here in first line we check whether Service Worker is supported by your browser. If yes, then register it. Give path to your service worker file you created earlier in the register function.</p><blockquote>You are done!</blockquote><p>Technically, yes. We are done making our web app Installable but it is better to test it. Following are the 2 ways(desktop and device) to test if your service worker is registered successfully and your web app install banner appears.</p><p>3. Open your application in chrome browser -&gt; open dev tools -&gt; Application tab -&gt; Service Workers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KEOS7mF3TfvRKxLLP0DZeg.png" /><figcaption>Service Worker Registered</figcaption></figure><p>4. To <strong>debug on actual android device</strong>, follow steps from official <a href="https://developers.google.com/web/tools/chrome-devtools/remote-debugging/">google documentation for remote debugging</a>.</p><ul><li>After above steps completed -&gt; open dev tools -&gt; Application tab -&gt; Under Manifest -&gt; click ‘Add to homescreen’ while connected to your device.</li><li>If everything goes well, you should see your first web app install banner.</li></ul><p>Voila! Your web app is now Installable and joined the prestige space of native apps.</p><p>Now let’s get some dirty and discuss 2 important things we left out so far :</p><p><strong><em>What are the requirements for Web App Install Banner?</em></strong></p><p><strong><em>And, What about the browser support?</em></strong></p><h3>Requirements</h3><ul><li>Include Web App Manifest file — <em>done</em></li><li>Register Service Worker— <em>done</em></li><li>Is served over HTTPS —<em> I hope you can handle that.</em></li><li>Meets a site engagement heuristic defined by Chrome.</li></ul><p>For more details, check <a href="https://developers.google.com/web/fundamentals/app-install-banners/#what_are_the_criteria">google documentation</a>.</p><h3>Browser Support</h3><ul><li>Shipped — <strong>chrome</strong>, <strong>opera</strong> and <strong>chrome for android </strong>which collectively covers 60.89% of global market. Check <a href="https://caniuse.com/#search=web%20app%20manifest">this</a> for more info.</li><li>In Dev — Edge, Firefox.</li><li>Under Consideration — safari.</li></ul><blockquote>So, should we forget about other browsers and don’t do anything about them?</blockquote><p><strong>Exactly not!</strong></p><p>Remember<strong> </strong>the word <strong>progressive</strong> in Progressive Web Apps(PWA). It means if one thing doesn’t working in any browser, find an alternative, to give the best experience to users on that browser.</p><p>So as an extra bonus! Following are some meta and link tags for <strong>safari </strong>and <strong>Internet Explorer </strong>to get some native app like experiences. Include them in your head tag.</p><h4>Properties for Safari</h4><pre><strong>&lt;meta name=&quot;apple-mobile-web-app-capable&quot; content=&quot;yes&quot;&gt;<br>&lt;meta name=&quot;apple-mobile-web-app-status-bar-style&quot; content=&quot;blue&quot;&gt;<br>&lt;meta name=&quot;apple-mobile-web-app-title&quot; content=&quot;With Manifest&quot;&gt;<br>&lt;link rel=&quot;apple-touch-icon&quot; href=&quot;/src/icons/apple-icon-152x152.png&quot; sizes=&quot;152x152&quot;&gt;<br>.<br>.      </strong>-&gt; Other similar image links for different sizes<strong><br>.</strong></pre><h4>Properties for Internet Explorer</h4><pre><strong>&lt;meta name=&quot;msapplication-TitleImage&quot; content=&quot;src/icons/icon-152x152.png&quot;&gt;<br>&lt;meta name=&quot;msapplication-TitleColor&quot; content=&quot;#fff&quot;&gt;<br>&lt;meta name=&quot;theme-color&quot; content=&quot;blue&quot;&gt;</strong></pre><p>I guess now everyone is happy and can party together!</p><p>Thank you for reading this far and I hope this post would help someone who is trying to find out <strong>why</strong>, <strong>what</strong> and <strong>how</strong> of <strong>Web App Manifest</strong> <strong>file</strong> or making their web app Installable. Please let me know if you would like to read any future blog posts on other PWA features like Service Worker Caching, Background Sync, native device features like Camera/Geolocation etc. or anything related to web in comments below.</p><p>Also, don’t forget to give some claps if you like this post :)</p><p><strong>Resources</strong>(used here)</p><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/Manifest">App Manifest All Possible Properties and Values</a></li><li><a href="https://caniuse.com/#search=web%20app%20manifest">Web App Manifest Browser Support </a>— <em>Can I use</em></li><li><a href="https://www.flaticon.com/">Free/Premium Ready made Icons</a></li><li><a href="https://app-manifest.firebaseapp.com/">Web App Manifest Generattor</a> — <em>Good for generating different icons</em></li><li><a href="https://manifest-validator.appspot.com/">Web Manifest Validator</a></li><li><a href="https://medium.com/@firt/dont-use-ios-web-app-meta-tag-irresponsibly-in-your-progressive-web-apps-85d70f4438cb">Don’t use meta tags irresponsibly in your PWA</a> — <em>by Maximiliano Firtman</em></li><li><a href="https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/">The Web App Manifest</a> — <em>Google Doc</em></li><li><a href="https://developers.google.com/web/fundamentals/engage-and-retain/app-install-banners/">Web App Install Banners </a>— Google Doc</li><li><a href="https://developers.google.com/web/tools/chrome-devtools/remote-debugging/">Remote Debugging android device via chrome browser</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5fcdb2919b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>