0

내 크롬 확장의 background.js에서 다음 함수는 현재 탭의 URL을 얻을 수 있습니다구글 크롬 : 현재 탭의 URL을 얻을 수

:

function getCurrentUrl() { 
    chrome.tabs.query({currentWindow: true, active: true}, function(tabs) { 
     var tab = tabs[0] 
     var keys = [] 
     for(var key in tab) keys.push(key + '-' + tab[key]) 
     alert(keys.join(', ')) 
    }) 
} 

을하지만, 경고 대화 상자가 저를 보여줍니다

active-true, height-456, highlighted-true, id-301, incognito-false, index-6, pinned-false, selected-true, status-complete, width-717, windowId-262 

'tab'객체에는 다른 답변에 나와있는 것처럼 url 속성이없는 것 같습니다. 내가 도대체 ​​뭘 잘못하고있는 겁니까?

"권한"[ "탭" ]

소스 : http://developer.chrome.com/extensions/tabs.html

답변

0

은 manifest.json을에 다음을 추가, URL을 액세스하려면
관련 문제