単純な拡張機能を作成していて、現在のタブを新しい場所に移動したいのですが、このコードは機能しません:
function redirect() {
console.log("HELLO");
chrome.tabs.getSelected(null, function(tab) {
var currentURL = tab.url;
if(currentURL == "http://example.site/"){
chrome.tabs.create("http://newlocation.site/",tab);
alert("redirected");
}
});
}
chrome.browserAction.onClicked.addListener(redirect);
とにかく、選択したタブのプロパティに関する情報をグーグルで検索することはできません。tab.url
「コマンド」のようなものはありますか?つまり、 tab.reload() .. など...