First things first :
- I am developing an extension for google chrome
- I have done sufficient research on how to build one and have got my manifest file and permissions all correct
- I am using the browserAction model and have my popup.html page all setup which is displayed every time i click the browserAction icon
- Just for debugging purposes, I have used a lot of window.alert popups in my code
- The popup.html file includes a call to a javascript file "call_content_script.js" which then calls the "content_script.js" file.
- The popup.html file also includes a link to another second_popup.js file
These are my codes :
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');
Now, I am facing two problems :
- every alert window pops up, except the one called in the content_script.js.
- After the I click the link from popup.html to second_popup.html, there is a popup for short time and then the popup window closes.
I dont understand why this is hapenning.
Thanks in advance