사용자가 아이콘을 누르면 변수에 현재 tab.id
을 저장하고 2 분 후 chrome.tabs.executeScript
함수를 실행하는 크롬 확장 기능이 있습니다. 지금까지 내가 말할 수있는, 내 코드가 작동해야하지만 난의 오류 얻을 :크롬 확장 - tabId를 사용하여 특정 탭 업데이트
Uncaught Error: Invalid value for argument 1. Property 'tabId': Unexpected property
From the chrome developer site
내 코드는 지금까지 있습니다 : 내 코드 뭐가 잘못에를 업데이트
chrome.tabs.update(integer tabId, object updateProperties, function callback)
은의 속성을 수정합니다 탭. 여기
//Up here is the logic for handling the icon press
chrome.tabs.query({ active: true, currentWindow: true }, function(arrayOfTabs) {
var activeTab = arrayOfTabs[0].id; //this is the active tab id.
setInterval(function() { //Interval for every 2 minutes
chrome.tabs.update({
tabId: activeTab, //this is where I get an error... What's wrong with this?
active: true,
url: "https://mywebsite.com/" + myarray[count]
}, function(tab) {
chrome.tabs.executeScript(tab.id, {
file: "function/jquery.min.js",
runAt: "document_end"
});
chrome.tabs.executeScript(tab.id, {
file: "function/code.js",
runAt: "document_end"
});
})
count++;
}, timer);
});
어떤 아이디어? 나는 activeTab
뿐만 아니라 tabId: activeTab
을 시도했지만 오류가 계속 발생합니다. 업데이트 할 탭을 tabs.update
에 어떻게 지정할 수 있습니까? 고맙습니다.
우수합니다. 고맙습니다. 그것이 나를 허용 할 때 나는 승인 할 것이다. – Katie
@Katie, 미안하지만 요구 사항에 대해서는 명확하지 않습니다. ''tabs.update'는 현재 탭에서 나를 빼앗지 않는다는 것을 무엇을 의미합니까? " –
아무것도 아니지만 문제가 해결되었습니다. 나는 '능동적 인'사실에 대해 혼란스러워했다. – Katie