0
我已經制作了一個Chrome擴展程序,可以在單擊瀏覽器操作按鈕時打開Windows計算器。現在,我試圖通過使用JavaScript代碼單擊來啓動網頁上的擴展。如何從網頁與擴展程序的後臺腳本進行通信
<!doctype html>
<html>
<head><title>activity</title></head>
<body>
<button id="clickactivity" onclick="startextension()">click</button>
<script>
\t
\t function startextension(){
\t \t //run/start the extension
\t }
\t
\t </script>
</body>
</html>
這是我background.js代碼:
chrome.browserAction.onClicked.addListener(function(){
chrome.extension.connectNative('com.rivhit.calc_test');
});
有沒有辦法做到這一點?