[ol]
[/ol]
function loadScript(url) {
var script = document.createElement('script');
script.src = url;
script.type = 'text/javascript';
document.head.appendChild(script);
}
// 调用函数加载其他 JavaScript 文件
loadScript(chrome.runtime.getURL('path/to/your/other-script.js'));
[ol]
[/ol]
"content_scripts": [
{
"matches": [""],
"js": [
"content.js",
"myfunction.js"
],
"type": "module"
}
],
myfunction.js:
function hello() {
console.log("Hello World")
}
content.js:
hello()