i want to create a chrome extension that opens a popup window and i want to use jquery in my html file.
i create my manifest.json
{
"name": "My First",
"description": "Test App",
"version": "0.1",
"app": {
"background": {
"scripts": ["background.js"]
}
},
"icons": { "16": "radio_tower-32.png", "128": "radio_tower-128.png" }
}
then i create a background.js
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('window.html', {
'bounds': {
'width': 250,
'height': 250
}
});
});
then create my html page
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery-1.11.0.min.js"></script>
</head>
<body>
<a onclick="$('.playeraudio')[0].pause();">Stop</a>
<audio controls="controls" autoplay class="playeraudio"><source src="http://mystream.mp3" type="audio/mp3" /></audio>
</body>
</html>
the jquery-1.11.0.min.js is in the folder but the click doesn't function. I tried to change the background.js using:
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('window.html', {
'bounds': {
'width': 250,
'height': 250
}
});
});
chrome.tabs.executeScript(null, { file: "jquery.js" }, function() {
chrome.tabs.executeScript(null, { file: "content.js" });
});
but it doesn't function (content.js is in the folder). Can anybody help me? what i need to change? Thanks