0
보이는 탭을 작은 이미지로 표시하는 팝업을 만들려고합니다. chrome.tabs.captureVisibleTab() 함수에서 반환 된 ImgSrc은 "정의되지 않음"입니다. 나는 이것을 여러 곳에서 달리기를 시도했다. tabs.Query()에서 반환 된 탭이 null이 아니므로 tab [0] .id가 null이 아님을 확인할 수 있습니다.Chrome Tabs.CaptureVisibleTab이 정의되지 않았습니다.
내가 잘못 했습니까?
{
"manifest_version": 2,
"name": "SuperFave",
"description": "Saves favorites demo",
"version": "1.0",
"browser_action": {
"default_popup": "popup.html"
},
"permissions": [
"tabs",
"<all_urls>"
]
}
popup.html :
<html>
<head>
<script type="text/javascript" src="jquery-1.10.2.min.js">
</script>
<script type="text/javascript" src="popup.js">
</script>
</head>
<body>
</body>
</html>
popup.js :
$(document).ready(function() {
chrome.tabs.query({
// gets the window the user can currently see
active: true,
currentWindow: true
},
function (tabs) {
chrome.tabs.captureVisibleTab(
tabs[0].id,
function (src) {
// displays a link to the image. Can be replaced by an alert() to
// verify the result is 'undefined'
$('body').append("<a href='" + src + "'>" + tabs[0].url + "</a>");
}
);
}
);
});