Created
February 6, 2017 08:38
-
-
Save hsinewu/c7e19fa6a26489e188c4ae88e57510f4 to your computer and use it in GitHub Desktop.
webextension tab url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"manifest_version": 2, | |
"name": "Tab url", | |
"description": "Shows url of the current page", | |
"version": "1.0", | |
"browser_action": { | |
"default_icon": "icon.png", | |
"default_popup": "popup.html" | |
}, | |
"permissions": [ | |
"tabs" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="info"></div> | |
<script src="popup.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var queryInfo = { | |
active: true, | |
lastFocusedWindow: true | |
} | |
chrome.tabs.query(queryInfo, function (tabs) { | |
var url = tabs[0].url; | |
info.textContent = url | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment