2016-03-27 26 views
0

Chrome uzantım gridir ve popup görüntülenemez. "https://scratch.mit.edu" ve tüm alt etki alanlarında çalışmaya çalışıyorum, ancak her sitede gri. Popup ayrıca herhangi bir sitede gösterilmez.Chrome uzantısı gri ve Pop-up görüntülenemiyor

manifest.json:

{ 
"manifest_version": 2, 
"background": { 
    "page": "background.html" 
}, 
"page_action": { 
     "default_icon": { 
     "19": "images/icon19.png", 
     "38": "images/icon38.png" 
     }, 
     "default_title": "Scratch theme loader", 
     "default_popup": "popup.html" 
    }, 
"permissions": [ 
    "storage", 
    "declarativeContent", 
    "https://scratch.mit.edu/*", 
    "https://pastebin.com/raw/*" 
] 
} 

background.html:

<!DOCTYPE html> 
<html> 
    <head> 
    <title>Background operation for Scratch Themes</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
    </head> 
    <body> 
    <script type="text/javascript"> 
     chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { 


     if (tab.url.indexOf('https://scratch.mit.edu') > -1) { 
     chrome.pageAction.show(tabId); 
     } else { 
     chrome.pageAction.hide(tabId); 
     } 
    }); 
    </script> 
    </body> 
</html> 

popup.html:

<!DOCTYPE html> 
<html> 
    <head> 
    <title>Scratch Themes</title> 
    <style> 
     body { 
     min-width: 357px; 
     overflow-x: hidden; 
     font-family: "Segoe UI", "Lucida Grande", Tahoma, sans-serif; 
     font-size: 100%; 
     } 
     img { 
     align: center; 
     } 
    </style> 
    </head> 
    <body> 
     <ul> 
     <li> 
      <img src = "images/S_Themes.png"> 
     </li> 
     <li> 
      <p>Choose which theme you would like to use:</p> 
      <form action=""> 
       <input type="radio" name="example" value="1"> Example 1<br> 
       <input type="radio" name="example" value="2"> Example 2<br> 
       <input type="radio" name="example" value="3"> Example 3 
      </form> 
     </li> 
    </body> 
</html> 

cevap

1

Sen koymalıdır js dosyaları tüm javascript kodu, html hiçbir betik arka plan, açılır pencere ve diğer uzantısı sayfalarında, hatta onclick öznitelikleri izin verilir.

+0

Bu harika çalıştı! Ayrıca "sekmeler" eklemek için izinleri değiştirmek zorunda kaldım. – Melkor

+0

Yeterli izinler, çapraz-kaynaklı sorunlar vb. Gibi şeyler genellikle benzer şekillerde mevcut olduğunu unutmayın. Görünür hatalar yok, uyarı yok, "tanımsız" sorun yok, sadece işe yaramayan kodlar - izin sorunlarının iyi bir işareti. –

İlgili konular