Learn

The forum of documents and methods for studying - Lượm lặt kiến thức


    chrome extension load error: the manifest_version key must be present and set to 2

    QaniTri
    QaniTri
    Admin

    Nam Libra Monkey
    Tổng số bài gửi : 1609
    Tiền xu Ⓑ : 3986
    Được cảm ơn № : 6
    Ngày khởi sự Ngày khởi sự : 07/01/2013
    Đến từ Đến từ : HCMC
    Côngviệc / Sởthix Côngviệc / Sởthix : Languages, Softwares, Sciences, Martial arts

    chrome extension load error: the manifest_version key must be present and set to 2 Empty chrome extension load error: the manifest_version key must be present and set to 2

    Bài gửi by QaniTri 30th September 2015, 01:23



    MVP Builders



    chrome extension load error: the manifest_version key must be present and set to 2

    chrome extension load error: the manifest_version key must be present and set to 2 Manifest_version_key_must_be_present_and_set_to_21
     
    If you are working through an older chrome extension tutorial, you will probably run through this error before any other error.  The reason you will likely get this error is that Chrome did not always force a version_manifest value in the manifest.json file.  Since moving from manifest_version 1 to manifest_version 2, I believe Google started to force the manifest to be declared because there were some changes from manifest_version of 1 to manifest_version of 2 that could break applications.
    Two fix this issue, you need to add manifest_version: 2 into the code, and make sure it still results in a validated json format.


    Example of Manifest.json that will cause this error


    Code:
    {
    "name": "A Sample Chrome Extension",
    "version": "1.0",
    "description": "Description of your Chrome extension.",
    "browser_action": {
    "default_icon": "icon.png",
    "popup": "popup.html"
    },


    “icons”:{
    “128”:”icon_128.png”
    }
    }
     

    Example Of Manifest.json that will fix this error


    Code:

    {
    "name": "A Sample Chrome Extension",
    "version": "1.0",
    "manifest_version": 2,
    "description": "Description of your Chrome extension.",
    "browser_action": {
    "default_icon": "icon.png",
    "popup": "popup.html"
    },


    “icons”:{
    “128”:”icon_128.png”
    }
    }



    Fixing The Tutorialzine How to Build a Chrome Extension Series
    Watch the Two Screencasts of debugging the entire tutorial


    1. You must set the manifest_version to 2
    2. icon.png needs to be downloaded
    3. Change popup variable name to default_popup - this is a very frustrating popup to find
    4. You need to download jquery.min.js and add it to the folder.  (I would download jquery-1.11.1.min.js and rename the script to jquery-1.11.1.min.js in tutorialzine.html
    5. You need to add a content_security_policy value to make external ajax calls and all external ajax calls must be made to https urls
    6. An extra broken image loads in the popup.  



    ibuildmvps.com


      Hôm nay: 22nd November 2024, 09:16