Hi everyone!
I'm making a chrome extension that displays current page's url once clicked. I've got this so far:
//manifest.json
{
// Required
"name": "Marker",
"version": "1.0.11",
"manifest_version": 2,
// Recommended
"description": "The ultimate bookmarking tool",
"icons": { "32": "icon.png" },
// Pick one (or none)
// Add any of these that you need
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"permissions": [
"tabs",
"http://*/*"],
"offline_enabled": false
}
<!--popup.html--> <!DOCTYPE html> <html> <head></head> <body> <h1>Shuttlr</h1> <h2>Lol</h2> <script type="text/javascript">
var pageurl = null;
chrome.tabs.query({'active': true, 'windowId': chrome.windows.WINDOW_ID_CURRENT},
function(tabs){
pageurl = tabs[0].url;
write_result(pageurl);
}
);
function write_result(needanurl){
document.write(needanurl);
}
</script> </body> </html>
I even made the chrome function fire up another function because the extensions API is asynchronous. I'm still stuck. What do I do?