我尝试通过Chrome扩展中的ContextMenu
获取所选DOM。
代码:
chrome.contextMenus.onClicked.addListener(function(info, tab){
// the info.selectionText just the text, don not contains html.
});
chrome.contextMenus.create({
title: "Demo",
contexts: ["selection"],
id: "demo"
});
但是info.selectionText中不包含HTML DOM信息。有没有办法在Chrome扩展程序的上下文菜单中获取选定的DOM?请给出建议。谢谢。