I'm trying to insert a div into a webpage using a Chrome extension. Here's my code in my background.js:
function CreateDiv(){
console.log(Created);
var div = document.createElement(div);
div.style.width = 100px;
div.style.height = 100px;
div.innerHTML = Hello;
document.body.appendChild(div);
}
chrome.contextMenus.create({title: Menu, onclick: CreateDiv});
console.log(Loaded);
After about an hour of experimenting, I released that it's creating a div on the background.html page, when I want it to create the div on the page I'm currently looking at. Has anybody got a way how I can do this? I've seen it done with extensions such as 'Ad Block' and I've looked at the code but I'm still lost... Has anybody got any suggestions on how I can do this?