0
크롬 용 도구 모음을 디자인하고 있습니다. background.html의 코드입니다.새 페이지가로드 될 때마다 스크립트를 실행하는 방법은 무엇입니까?
<script>
function addToolbar() {
return function(info, tab) {
chrome.tabs.executeScript(tab.id, {file: "toolbar.js"})
};
};
addToolbar();
</script>
iframe을 만들고 문서에 추가하는 코드가 있습니다. "addToolbar()"함수가 자동으로 실행되지 않으므로 도구 모음이 나타나지 않습니다. 어떻게하면됩니까?
편집 : 내 toolbar.js 코드 :
var iframe = document.createElement("iframe");
iframe.setAttribute("src", "http://www.example.com/mytoolbar.html");
iframe.style.cssText='position:fixed;width:100px;height:50px;bottom:0px;left:0px;';
(document.body||document.documentElement).appendChild(iframe);
두 솔루션을 모두 시도했지만 작동하지 않습니다. – xRobot