chrome.tabs.captureVisibleTab exclude certain elements from captured image

486 views
Skip to first unread message

Steven

unread,
Oct 10, 2018, 5:28:37 AM10/10/18
to Chromium Extensions
I'm not sure how chrome.tabs.captureVisibleTab works but would it be possible to exclude elements from the DOM from the resulting image or only capture certain elements? 

This feature would be very handy for me!

Cheers,
Steven.


Daniel Moffat

unread,
Oct 10, 2018, 8:05:15 AM10/10/18
to Chromium Extensions
It doesn't seem like there's a way to capture specific elements, but you could try inserting either CSS or JS into the active tab, which would hide the elements you don't want to see.

Steven

unread,
Oct 12, 2018, 12:18:07 AM10/12/18
to Chromium Extensions
Hey Daniel,

Thanks for the reply, unfortunately the element can't flash out and in for my user case though.

PhistucK

unread,
Oct 13, 2018, 1:15:30 PM10/13/18
to stev...@hotmail.com, Chromium-extensions
What about creating a new non-active tab with the exact same DOM (minus scripts, do not go nuts ;)), removing the elements, capturing it and closing it?

PhistucK


--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/2b608817-aab0-418e-b598-0ff6ab18e6f6%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.
Message has been deleted

absolutedjmykey

unread,
Oct 14, 2018, 11:51:03 AM10/14/18
to Chromium Extensions


Op woensdag 10 oktober 2018 11:28:37 UTC+2 schreef Steven:
Message has been deleted

absolutedjmykey

unread,
Oct 14, 2018, 11:51:33 AM10/14/18
to Chromium Extensions


Op woensdag 10 oktober 2018 11:28:37 UTC+2 schreef Steven:
I'm not sure how chrome.tabs.captureVisibleTab works but would it be possible to exclude elements from the DOM from the resulting image or only capture certain elements? 

absolutedjmykey

unread,
Oct 14, 2018, 11:51:52 AM10/14/18
to Chromium Extensions


Op woensdag 10 oktober 2018 14:05:15 UTC+2 schreef Daniel Moffat:

absolutedjmykey

unread,
Oct 14, 2018, 11:52:03 AM10/14/18
to Chromium Extensions


Op woensdag 10 oktober 2018 14:05:15 UTC+2 schreef Daniel Moffat:
It doesn't seem like there's a way to capture specific elements, but you could try inserting either CSS or JS into the active tab, which would hide the elements you don't want to see.

absolutedjmykey

unread,
Oct 14, 2018, 11:52:11 AM10/14/18
to Chromium Extensions


Op woensdag 10 oktober 2018 14:05:15 UTC+2 schreef Daniel Moffat:
It doesn't seem like there's a way to capture specific elements, but you could try inserting either CSS or JS into the active tab, which would hide the elements you don't want to see.
Message has been deleted

Morgan Brown

unread,
Feb 15, 2023, 12:47:26 PM2/15/23
to Chromium Extensions, absolutedjmykey
We've been having success so far with: 

element.style.display = 'none'
// query offsetParent to trigger synchronous reflow/layout
element.offsetParent
window.requestAnimationFrame(() => {
  // we do this again here, not sure if necessary to be honest
  element.offsetParent
  // do captureVisibleTab <=
})

Any other solutions pop up in these intervening years?

Reply all
Reply to author
Forward
0 new messages