如何从Google Chrome扩展程序获取当前标签的网址? [英] How can I get the URL of the current tab from a Google Chrome extension?
本文介绍了如何从Google Chrome扩展程序获取当前标签的网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Google Chrome浏览器扩展程序中玩得很开心,我只想知道如何将当前选项卡的网址存储在变量中?
朋友回答我的问题。
首先,您必须设置标签API的权限:
permissions:[
标签
]
并存储URL:
chrome.tabs.getSelected null,function(tab){
var tablink = tab.url;
});
I'm having fun with Google Chrome extension, and I just want to know how can I store the URL of the current tab in a variable?
解决方案
A friend answers to my question.
First, you've to set the permissions for the tab API :
"permissions": [
"tabs"
]
And to store the URL :
chrome.tabs.getSelected(null,function(tab) {
var tablink = tab.url;
});
这篇关于如何从Google Chrome扩展程序获取当前标签的网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文