Skip to content

Instantly share code, notes, and snippets.

@e-roy
Forked from dotproto/LICENSE
Last active January 29, 2021 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save e-roy/f64a03b3f6bfc26062c8316163473991 to your computer and use it in GitHub Desktop.
Save e-roy/f64a03b3f6bfc26062c8316163473991 to your computer and use it in GitHub Desktop.
Minimal working Manifest V3 extension.
// Copyright 2019 Google LLC.
// SPDX-License-Identifier: Apache-2.0
chrome.action.onClicked.addListener(handleBrowserActionClicked)
function handleBrowserActionClicked(tab) {
const opts = {
url: chrome.runtime.getURL('popup.html')
};
chrome.windows.create(opts, handleWindowCreated);
}
function handleWindowCreated(window) {
console.log('done');
}
Copyright 2019 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{
"name": "Basic MV3 Demo",
"version": "0.1.0",
"manifest_version": 3,
"background": {
"service_worker": "background.js"
},
"action": {
"default_title": "Click me to open a new window"
}
}
<!DOCTYPE html>
<html lang="en">
<!--
Copyright 2019 Google LLC.
SPDX-License-Identifier: Apache-2.0
-->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h2>Hello, world!</h2>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment