2013-08-17 3 views
0

그냥 간단한 탭을 만들려고하는데 제대로 작동하지 않습니다. 내가 뭘 잘못하고 있는거야?크롬 확장 프로그램 : 탭을 만들 수 없습니다.

manifest.json을

{ 
    "manifest_version": 2, 
    "browser_action": { 
     "default_icon": { 
      "19": "logo_19.png" 
     }, 
     "default_title": "Test Suite", 
     "default_popup": "main.html" 
    }, 
    "description": "Test Suite Description", 
    "icons": { 
     "128": "icon_128.png", 
     "16": "icon_16.png" 
    }, 
    "name": "Test Suite", 
    "permissions": ["http://www.google.com/"], 
    "version": "1.0" 
} 

main.html

<html> 
<head> 
<script type="text/javascript" src="popup.js"> 
</script> 
</head> 
<body> 
    <div id="menu-items-ui">  
    <div id="registration"> 
    Google Search 
     </div> 
    </div> 
</body> 
</html> 

popup.js

<script type="text/javascript"> 
document.addEventListener('DOMContentLoaded', function() { 
    var registration = document.getElementById('registration'); 
    registration.addEventListener('click', function() { 
     chrome.tabs.create({ url: 'http://www.google.com' }); 
    }); 
}); 
</script> 

그것은 구글 사이트로 이동하지 않습니다. 미리 감사드립니다.

답변

0

당신은 당신의 자바 스크립트 파일에 HTML을 가지고, 그것을

popup.js

을 제거
document.addEventListener('DOMContentLoaded', function() { 
    var registration = document.getElementById('registration'); 
    registration.addEventListener('click', function() { 
     chrome.tabs.create({ url: 'http://www.google.com' }); 
    }); 
}); 
+0

죄송합니다 부탁하기 전에주의해야! – Samuel

관련 문제