RT, there is a chrome plug-in, there is a button in the html page of the plug-in, click the button, how to call the function defined in the plug-in and the js file?
In the index.html page of the plug-in:
<button onclick='test()'>开始获取</button>
In the main.js file of the plug-in:
function test(){
console.log('come from test');
}
Link main.js in index.html
//index.html在html文件夹中,注意这里要使用相对路径
<script src="../script/main.js" charset="utf-8"></script>
It is not feasible to directly bind the test() function to the button, so how to call it
Right-click on the plug-in, check the plug-in console, and find an error
Be sure to note that the plug-in console and the page console are not in the same place