Procasti..nator: Chrome Extension Part 3

JavaScript Chrome Extensions

English (Auto-generated)

hi everyone. So let's go ahead and talk about what the manifest dot Jason file does and why it's needed. So the manifest file tells chrome important information about your extension like its name. Version and which permissions it needs. And in this file we have required recommended and optional fields which google uses. And google is going to use this file to acquire details about your extension when you publish it. So let's go ahead and um and let's start off by filling in all the required fields of the manifest dot Jason file. So in your project folder you should already have this and it's MTs yet. So Let's go ahead and structure this. And the first thing we have is the manifest version and this is a version two. So this is the version of the manifest file format and as of chrome version 18 version one is deprecate id and you have to use version two and then we have the name field and the name field is whatever. This can be up to 45 characters and it's used to display your extensions name in a couple of places. For example the install dialog extension management, ui and chrome web store. So let's call our extension is called procrastination nature procrastinator. And then after that we have the version. So this is the version of our chrome extension and region there we go. Okay. And it can be up to four digits separated by dots. And this will just leave this at region 1.0 point is zero. So this is a string value and then we have this browser action object. So browser and the score action. And this is going to be an a nested object here and the browser action object has a default and the score pop up key. And the the value of this key is going to be index dot html. And this is the file from which the extension will boot. And let's go ahead and put a comma here. And lastly we have something which is going to be called permissions. So chrome provides extensions with many special purpose A P. I. S for example, chrome dot runtime, Chrome alarms, Chrome Idol etcetera. And to use these special purpose A. P. I. S. We need to use the permissions key. And in a chrome extension we will need permission to use the Idol A. P. I. And Idol gives our extension access to the uh to chrome's Idol A. P. I. And then we're going to use this idol api to detect when the machine's idle state changes. So an idle state is defined when there is no action on the screen. And this means the user isn't crawling up or down the screen and the user isn't clicking anywhere on the web page. So we have to declare the Idol permission in the manifest file to use this special purpose api that Chrome provides. So after that Uh let's go ahead and double check everything is looking fine. So we have manifest version two and then we have the name which is procrastinator. And uh we have version 1.0.0 and I have the browser action. It's a nested object with a default pop up whose value uh is index dot html. And then we have the permissions key, which is an array with only one um value, which is idle since we're using chrome's Idol API. So let's go ahead and save this. And that's all for this cast in the next cast will actually add the chrome extension to the browser just to check what it looks like so far.
20 Views 1 Likes 0 Comments

Let's start working on the manifest.json file for our extension

Leave a comment (supports markdown format)