I am trying to make a chrome extension that injects code into the active webpage through the popup.html file...
popup.html >
<!DOCTYPE html>
<html>
<body>
<button id="Mr_Button-Click_Extend">hello this is a test</button>
</body>
</html>
<script>
document.getElementById("Mr_Button-Click_Extend").addEventListener("click", TheGreatEmbed()
{
chrome.tabs.executeScript(null, {file: 'js/inject.js'});
});
</script>
js/inject.js >
document.write('<h1 style="position: fixed; top: 200; left: 200; z-index: 999999;">testing... testing...</h1>');
manifest >
{
"name": "GAME HUB.io copy",
"version": "0.0.1",
"manifest_version": 2,
"description": "YEET",
"homepage_url": "https://www.youtube.com/channel/UCbmPRCzP88oaId-4piz5Weg",
"icons": {
"128": "icons/Icon-128.png"
},
"default_locale": "en",
"browser_action": {
"default_icon": "icons/Icon-128.png",
"default_title": "GAME HUB.io TEST MESSAGES",
"default_popup": "src/html/popup.html"
},
"permissions": [
"activeTab",
"http://*/*",
"https://*/*",
"<all_urls>",
"webRequest"
]
}
This question has been simplified to make it easier to understand... This attempt at solving the other more complicated question has been tried due to @Drapaster 's answer to the older question.
The code examples above are just the basic functionality that I am striving to accomplish.
The question is why didn't this work? What am I missing here? Do I need to move the content from the script tags to a new file named for example: popup-helper.js? Modify the manifest? Or is it something else? Please help...