The following is my code
document.getElementById('randomname').onclick = () => {
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
chrome.scripting.executeScript({
target: {tabId: tabs[0].id},
function: randomName
});
});
}
function randomName() {
// Your script goes here
var name = extern.generateRandomName()
alert(name);
}
My issue is that when this code is run, because it is not defined in my js file, it says it is not defined. BUT, this function extern.generateRandomName()
is defined on the website this code is running on.