📜  Chrome 扩展获取选择 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:03.710000             🧑  作者: Mango

代码示例1
chrome.extension.onMessage.addListener(function(request, sender, sendResponse) {
  if (request.method == "getSelection")
    sendResponse({data: window.getSelection().toString()});
  else
    sendResponse({}); // snub them.
});