Send DOM node object via chrome.tabs.sendMessage

后端 未结 2 1918
轮回少年
轮回少年 2020-12-20 07:43

I am writing a Chrome extension. I need to pass an element object from the content script to the background script.

The goal:
The extension is about record and r

2条回答
  •  渐次进展
    2020-12-20 08:21

    I used a workaround to click the element,

    besides save the element and then using element.click() I used the cords to click the element without saving the element itself:

    document.elementFromPoint(cords.x - window.pageXOffset, cords.y - window.pageYOffset).click();
    

提交回复
热议问题