6

我已經看過Google的文檔,但我看不到如何改變它的類型。如何將我的「遺留封裝應用程序」更改爲「擴展名」?

這是我加載的錯誤。

嘗試安裝此擴展程序時出現警告: 'browser_action'僅適用於擴展程序,並且這是一個傳統打包的應用程序。

這是我的manifest.json。

{ 
    "name": "first app", 
    "description": "this is my first app", 
    "version": "1.4", 
    "manifest_version": 2, 

    "content_security_policy": "script-src 'self' https://en.wiktionary.org/; object-src 'self'", 


    "background": { 
    "page": "background.html" 
    }, 

"app": { 
    "launch": { 
     "local_path": "index.html"  

    } 
    }, 

    "browser_action": { 
    "default_icon": "icon.png" 
    }, 

    "icons": { 
    "128": "icon.png", 
    "16": "icon.png" 
    }, 
    "permissions": [ 
    "http://*/*", 
    "https://*/*", 
    "https://en.wiktionary.org/", 
    "http://en.wiktionary.org/", 
    "tabs", 
    "contextMenus", 
    "storage", 
    "unlimitedStorage", 
    "notifications"] 

} 

我只有一個鼠標右鍵單擊任何一次事件,而瀏覽和存儲文本查看主頁上。我在「browser_action」中添加了Chrome商店,並不意味着我可以將我的擴展作爲「傳統打包的應用程序」上傳,但是我甚至在閱讀完文檔之後並不明白它是什麼。

+1

目前還不清楚你要完成,因爲你還沒有包括代碼的其餘部分是什麼,但清單中的「應用程序」字典使其成爲應用程序。刪除。然後將您的擴展程序與Chrome「擴展程序入門」擴展名進行比較:http://developer.chrome.com/extensions/getstarted.html – sowbug

回答

10

對於an app使用清單看起來像:

{ 
    // Required 
    "app": { 
    "background": { 
     // Optional 
     "scripts": ["background.js"] 
    } 
    }, 
    "manifest_version": 2, 
    "name": "My App", 
    "version": "versionString", 

    ... 

對於an extension使用

{ 
    // Required 
    "manifest_version": 2, 
    "name": "My Extension", 
    "version": "versionString", 

    // Recommended 
    "default_locale": "en", 
    "description": "A plain text description", 
    "icons": {...}, 

    // Pick one (or none) 
    "browser_action": {...}, 
    "page_action": {...}, 

    ... 
+1

以及託管應用程序的清單是什麼? –

+0

以下是託管應用程序的基本清單:https://computers.tutsplus.com/tutorials/quick-tip-make-a-chrome-app-shortcut-for-any-web-app--cms-21221 –

相關問題