Chrome 확장을 만들려고하는데 browser action 클릭이 작동하지 않습니다! 나는 거의 모든 것을 시도했다. 여기 내 설정이다 :Chrome 브라우저 동작이 작동하지 않음
의 manifest.json :
{
"name": "blah",
"version": "1.0",
"description": "blah",
"browser_action": {
"default_icon": "icon1.png",
"popup": "popup.html"
},
"permissions": [
"bookmarks",
"tabs",
"http://*/*",
"https://*/*"
],
"background_page": "background.html"
}
popup.html :
<html>
<head>
<script>
<!-- Try adding the listener in popup.html -->
chrome.browserAction.onClicked.addListener(function(tab){
console.log("Hello from popup"); // This does not show up either
});
</script>
</head><body>
Hello
</body>
</html>
background.html :
<html>
<head>
<script>
console.log("Background.html"); // This gets displayed. O.K.
function hello() {
console.log("HELLO"); // THIS NEVER GETS DISPLAYED
}
// Supposed to Called when the user clicks on the browser action icon.
chrome.browserAction.onClicked.addListener(hello);
</script>
</head>
</html>
하지만 클릭 아무리 열심히 아이콘은 아무런 일도 일어나지 않으며 "HELLO"는 콘솔에 출력되지 않습니다!
Chrome 4.0.249.43을 사용하고 있습니다. 나는 베타 버전을 설치했으나 출시 된 버전 (동일한 버전 번호)과 정확히 동일합니다. 그게 문제가 될 수 있습니까?
맞습니다. 팝업은 onclick 이벤트를 완전히 제거합니다! 그걸 알아 내는데 이틀이 걸렸어. – drozzy
Chrome 확장 팀의 모든 사용자가 POLA에 대해 들어 봤습니까? https://en.wikipedia.org/wiki/Principle_of_least_astonishment – Pacerier
크롬의 확장 문서가 아프다 – Legends