I'm pretty new on chrome extensions and so far, I could manage to get the current tab title and mouse positions, however, I've made some searches and couldn't find a way to get the element attributes, such as "e.target.innerText" when I click on them, right click and get a new option, anything from a mouse input, does anyone knows how to do so?
This is what my popup.js looks like
window.onclick = e => {
chrome.extension.getBackgroundPage().chrome.tabs.executeScript(null, {
code:'chrome.runtime.sendMessage(document.title)'
});;
}
chrome.runtime.onMessage.addListener(function (message) {
document.getElementById('pagetitle').innerHTML = message;
});
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…