简体   繁体   English

Manifest.json文件在javascript中无法正常工作?

[英]Manifest.json file not working properly in javascript?

i have a chrome extension for creating a button in Gmail webpage. 我有一个Chrome扩展程序,可以在Gmail网页中创建按钮。

the button was created successfully in on that page.but after refreshing that page,the button was not created.it gives aa class undefined. 该按钮已在该页面上成功创建。但是刷新该页面后,该按钮未创建。它给一个未定义的类。

after clearing the cache and cookies,it works.but not all time,sometimes only. 清除缓存和cookie后,它可以正常工作。

my manifest.json file code here: 我的manifest.json文件代码在这里:

{
  "manifest_version": 2,

  "name": "E-mail Security",
  "description": "This extension demonstrates a Email security ",
  "version": "1.0",

  "browser_action": {
    "default_icon": "icon.png",
    "default_popup": "popup.html"
  },
  "permissions": [ "notifications", "contentSettings", "cookies", "tabs", "contextMenus", "http://*/*", "https://*/*" ],

  "content_scripts": [
    {     

    "matches": ["http://*/*", "https://*/*"],
      "js": ["ngContent.js","jquery.js"]

    }
]

}

why,that above problem was occured.whether i miss something in manifest.json file? 为什么,发生了上述问题。我是否在manifest.json文件中错过了某些内容?

note:i am using chrome browser. 注意:我正在使用Chrome浏览器。

Create the button when the page loads. 页面加载时创建按钮。 Then perhaps define an event for MutationObserver. 然后也许为MutationObserver定义一个事件。 Every time the button disappears, your code should get triggered to create it once again. 每次按钮消失时,您的代码应被触发以再次创建它。 Then apply whatever other rules/actions you want to for that button. 然后,对该按钮应用您想要的其他任何规则/操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM