1

我想爲谷歌Chrome的主題,但我想有一個彈出窗口出現時,它被安裝。我不確定這是否可能,因爲主題與擴展不同。谷歌Chrome主題與安裝後彈出

所以我想,這個清單文件我能夠與擴展做到這一點:

{ 
    "background": { 
     "persistent": false, 
     "scripts": [ "script.js" ] 
    }, 
    "description": "Een test", 
    "manifest_version": 2, 
    "name": "Test Extension", 
    "version": "0.0.2" 
} 

在的script.js我得到這個代碼:

chrome.runtime.onInstalled.addListener(function(){ 
    window.open('http://www.example.com','','width=800,height=500'); 
}); 

這一切工作好。現在困難的部分是用這個主題。事情就是,當我將一個主題對象添加到清單文件中時,事情似乎不能正常工作:腳本將不會再執行。所以在這一點上我的清單文件看起來是這樣的:

{ 
    "background": { 
     "persistent": false, 
     "scripts": [ "script.js" ] 
    }, 
    "description": "Een test", 
    "manifest_version": 2, 
    "name": "Test Extension", 
    "theme": { 
     "colors": { 
     "bookmark_text": [ 255, 255, 255 ], 
     "frame": [ 12, 20, 30 ], 
     "ntp_background": [ 11, 21, 35 ], 
     "ntp_header": [ 40, 40, 40 ], 
     "ntp_link": [ 0, 0, 0 ], 
     "ntp_section": [ 255, 255, 255, 0.5 ], 
     "ntp_section_link": [ 0, 0, 0 ], 
     "ntp_section_text": [ 0, 0, 0 ], 
     "ntp_text": [ 255, 255, 255 ], 
     "tab_background_text": [ 10, 10, 10 ], 
     "tab_text": [ 255, 255, 255 ], 
     "toolbar": [ 6, 13, 21 ] 
     }, 
     "images": { 
     "theme_frame": "img/frame.jpg", 
     "theme_frame_overlay": "img/frame_overlay.png", 
     "theme_ntp_attribution": "img/ntp_attribution.png", 
     "theme_ntp_background": "img/ntp_background.jpg", 
     "theme_tab_background": "img/tab_background.jpg", 
     "theme_tab_background_incognito": "img/tab_background.jpg", 
     "theme_toolbar": "img/toolbar.jpg" 
     }, 
     "properties": { 
     "ntp_background_alignment": "bottom right", 
     "ntp_background_repeat": "no-repeat" 
     }, 
     "tints": { 
     "buttons": [ 1, 1, 1 ] 
     } 
    }, 
    "version": "0.0.2" 
} 

我猜它不工作了,因爲該文件將現在被歸類爲一個主題。不過,我想我可以在這裏發佈這個問題。我希望你們有建議。

回答