Skip to content

Commit

Permalink
Open a new tab when the extension is clicked
Browse files Browse the repository at this point in the history
Refer to Stackoverflow Answer: https://stackoverflow.com/a/38338182
  • Loading branch information
vrajat committed May 1, 2023
1 parent 288dbba commit ef8998d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions extension/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.create({'url': chrome.extension.getURL('popup.html'), 'selected': true});
});
12 changes: 8 additions & 4 deletions extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
"version": "1.0",
"manifest_version": 2,
"description": "This extension allows you to pretty print JSON.",
"permissions": ["activeTab"],
"browser_action": {
"default_title": "JSON Pretty Print",
"default_popup": "popup.html"
"permissions": [
"*://*/*",
"<all_urls>"
],
"browser_action": {},
"background": {
"scripts": ["background.js"],
"persistent": false
}
}

0 comments on commit ef8998d

Please sign in to comment.