简体   繁体   English

如何在带有 Manifest 3 的 Google Chrome 扩展程序中使用 JQuery?

[英]How can I use JQuery in my Google Chrome extension with Manifest 3?

I am trying to figure out how I can use JQuery in my background.js for Google Chrome extension development for Manifest 3. All of the other answers I have found are for Manifest 2.我试图弄清楚如何在我的 background.js 中使用 JQuery 来开发 Manifest 3 的 Google Chrome 扩展程序。我找到的所有其他答案都是针对 Manifest 2 的。

Thank you in advance for the help.预先感谢您的帮助。

After some more research and time spent trying to figure out how to make this work I figured it out.经过更多的研究和花费时间试图弄清楚如何完成这项工作后,我想通了。

To add jquery to your background.js you need to add the following to your manifest.要将 jquery 添加到您的 background.js,您需要将以下内容添加到您的清单中。

  "content_scripts": [
    {
      "css":["/css/jquery/jquery-ui.min.css", "/css/jquery/jquery-ui.structure.min.css"],
      "js":["/js/jquery/jquery-3.6.0.min.js", "/js/jquery/jquery-ui.min.js"],
      "matches": ["*://*/*"],
      "run_at": "document_end"
    }
  ],

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

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