LoginSignup
0
0

More than 5 years have passed since last update.

Chrome 拡張機能を使う

Posted at
  • 備忘録

sample

manifest.json
{
  "name": "hoge",
  "version": "0.0.1",
  "manifest_version": 2,
  "description": "Chrome Extensions Test.",
  "content_scripts": [
    {
      "matches": ["http://xxx.xxx.xxx.xxx/chromeExt/*"],
      "js": [
        "scripts/jquery-3.2.1.min.js",
        "scripts/main.js"
      ],
      "run_at": "document_idle"
    }
  ]
}
index.html
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Chrome Extensions Test</title>
  </head>
  <body>
    <div id="main"></div>
  </body>
</html>
scripts/main.js
$(function() {
  var extHtml = '<input type="button" id="extBtn" value="Download">';
  var main = $("#main");
  main.append(extHtml);

  $("#extBtn").on("click", function() {
    console.log("extBtn clicked.");
  });
});

参考リンク

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0