首先要做的事情:
这些是我的代码:
的 popup.html 的的
<!doctype html>
<html>
<head>
</head>
<body>
<h1>My Hello World Extension!</h1>
<a href="second_popup.html">go to some other page</a>
<script src="../javascript/call_content_script.js"></script>
<!-- JAVASCRIPT FILES HAVE TO BE RUN FROM A SEPERATE
SCRIPT FILE. THIS IS A SECURITY FEATURE, ADDED
IN MANIFEST VERSION 2.0
-->
</body>
</html>
的 second_popup.html 的的
<!doctype html>
<html>
<body>
<p>nothing to see here</p>
<a href="popup.html">go back</a>
</body>
</html>
的 call_content_script.js 的的
window.alert('call content script working');
chrome.tabs.query({"active":true},function(tabs) {
window.alert(tabs[0].id);
chrome.tabs.executeScript({file:"content_script.js"});
//REQUIRES "permissions" : "activeTab"
});
window.alert('exiting call_content_script');
的 content_script.js 的的
window.alert('content script working');
我不明白为什么这是hapenning。
提前致谢