I am new to Javascript as well as Chrome extension development. I was trying to open a tab when the user clicks on the extension button. This is how my popup.html
looks like
<!DOCTYPE html>
<head>
<title> Qoogle Homepage</title>
<script type="text/javascript">
var newURL = chrome.extension.getURL('qoogle.html');
chrome.tabs.create({ url: newURL });
</script>
</head>
</html>
I have declared the tabs
permission in my manifest.json
and qoogle.html
lays in the same directory. But when I click on the extension, nothing happens.
Now, I tried to include <script src="popup.js"></script>
line into my popup.html
and then wrote
var newURL = chrome.extension.getURL('qoogle.html');
chrome.tabs.create({ url: newURL });
inside the popup.js file. This works fine.
I don't want too many files in my folder. What could be the reason my script does not get executed from the HTML and works fine when added separately as a JS file?