How to grab the html of a div that the user hover on

Skip to first unread message

aziz boudi

Jan 20, 2021, 6:30:51 AMJan 20
to Chromium Extensions
I'm trying to grab the html of the div that the user hover on, can this be done using the method chrome.pageCapture.saveAsMHTML? or are there other methods that allow me to do that ?

Thanks in advance


Jan 20, 2021, 10:17:30 AMJan 20
to Chromium Extensions,
You can get outerHTML of the element on hover. You can also copy the outerHTML to clipboard and prompt to save using File System Access API.

Simeon Vincent

Jan 22, 2021, 5:53:38 PMJan 22
to Chromium Extensions,,
Ah, but how do you determine which element to get the outer HTML of? Aziz, you might want to checkout Stack Overflow. This answer in particular seems pretty solid to me.

Also, to answer your question about saveAsMHTML; no, that's now what that method does. It saves the entire page, not a subset of the DOM tree.


Simeon - @dotproto
Chrome Extensions DevRel
Reply all
Reply to author
0 new messages