Last active
May 26, 2017 05:34
Chrome Extension Easy Sample
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": "Google extensions easy sample", | |
"description": "Show current page URL", | |
"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
/* | |
File:popup.css | |
Author:SolinariWu | |
Descript:Google Extensions Easy Sample-Show current page URL | |
Date:2016/7/25 | |
Reference:https://developer.chrome.com/extensions | |
http://www.cnblogs.com/guogangj/p/3235703.html | |
*/ | |
body { | |
width: 200px; | |
} |
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
<!-- | |
File:popup.html | |
Author:SolinariWu | |
Descript:Google Extensions Easy Sample-Show current page URL | |
Date:2016/7/25 | |
Reference:https://developer.chrome.com/extensions | |
http://www.cnblogs.com/guogangj/p/3235703.html | |
--> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Google Extensions Easy Sample</title> | |
<link rel="stylesheet" type="text/css" href="popup.css" /> | |
</head> | |
<body> | |
<div id = "msgLabel" ">Show URL</div> | |
</body> | |
<script src="jquery-3.1.0.min.js"></script> | |
<script src="popup.js"></script> | |
</html> |
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
/* | |
File:popup.html | |
Author:SolinariWu | |
Descript:Google Extensions Easy Sample-Show current page URL | |
Date:2016/7/25 | |
Reference:http://www.cnblogs.com/guogangj/p/3235703.html | |
https://developer.chrome.com/extensions | |
*/ | |
document.addEventListener('DOMContentLoaded', function () { | |
chrome.tabs.query({'active': true, 'lastFocusedWindow': true}, function (tabs) { | |
var url = tabs[0].url; | |
$("#msgLabel").text(url); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment