我已經按照Getting the source HTML of the current page from Chrome extension從當前頁面獲取HTML源代碼,我修改了chrome.runtime.onMessage.addListener
功能是這樣的:如何在chrome擴展中使用window.print()?
chrome.runtime.onMessage.addListener(function(request, sender) {
if (request.action == "getSource") {
message.innerText = request.source;
//my code
window.print();
}
});
但window.print()
不起作用,你可以請幫我糾正嗎?
非常感謝您提供任何幫助!
在該文件中,你調用打印?它必須位於內容腳本中,而不是後臺任務。 – sdgluck