How to create a Chromeapp

Source: Internet
Author: User

A Chromeapp contains the following: 1. The manifest file Manifest.json, which lists some basic information about the app, such as how to launch the app, permissions for the app, and more. 2. The event handling page is what we often call a background script (background script), which manages the entire activity cycle of the app, and this is where you handle some of the event's listening, such as how to start, close the app's form. 3. All code files must be packaged into a single chromeapp, containing Html,css,js and local templates 4. Other files, sample files also have to be packaged under Chromeapp to create an app the first step: Create a Manifest.json
{  "manifest_version": 2,  "name": "Codelab",  "version": "1",  "icons": {    "$": "Icon_128.png"  },  "Permissions": [],  "app": {    "background": {      "scripts": ["Background.js"]    }  },  "minimum_chrome_version": "28"}
It is important to note that the first line of "Manifest_version": 2 This must be added permissions how to access the site you need to add here background is the background script we have to deal with icons You need to provide a square picture (this will be shown in the Chromeapp's list of applications), and the size is the first parameter (px) 2. Add a picture that is icons, note that the size should be consistent with the previous, for example 128x128 3. Create Backgroud.js
/** * listens for the app launching then creates the window * * @see http://developer.chrome.com/apps/app.window.html */ch Rome.app.runtime.onLaunched.addListener (function () {  chrome.app.window.create (' index.html ', {    ID: ' Main ',    bounds: {width:620, height:500}  });
This function means to add a listener when the app starts, open index.html this site (next we'll create this) fourth step to create index.html
<! DOCTYPE html>
After completing the above steps, a Chromeapp related file is basically completed. The next step is to run. Run the program in the Chrome address bar to enter chrome://extensions/can open the extension list, tick "developer mode", click on "Load the expansion program in development" to open the Chromeapp package can see your app appears in the list. Click "Start" below the app to see the effect.

How to create a Chromeapp

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.