mirror of
https://github.com/GoogleChrome/chrome-extensions-samples.git
synced 2026-03-27 13:29:34 +07:00
* Init commit * Add sidepanel open cookbook * Add minimum chrome version * Add 116 on readme * Add extension page Add content script * Tweak * Tweak 2 * ¯\_(ツ)_/¯ * Update readme * Update readme * Change sample name in Readme * Bold Chrome 116 for emphasis * Typo fix
9 lines
275 B
JavaScript
9 lines
275 B
JavaScript
const button = new DOMParser().parseFromString(
|
|
'<button>Click to open side panel</button>',
|
|
'text/html'
|
|
).body.firstElementChild;
|
|
button.addEventListener('click', function () {
|
|
chrome.runtime.sendMessage({ type: 'open_side_panel' });
|
|
});
|
|
document.body.append(button);
|