Adding screenshot functionality to a firefox extension

前端 未结 3 396
醉话见心
醉话见心 2021-01-31 06:40

Is there a cross-platform approach to taking screenshots from a firefox extension?

Ideally I\'d like to be able to take a screenshot of a dom element (irrespective of wh

3条回答
  •  情话喂你
    2021-01-31 07:08

    I guess it would be something like this:

    1. Copy the DOM element in question to a separate iframe or browser (which is not visible to the user)
    2. Paint the window of that iframe onto an html canvas using drawWindow(). Check out the source of the Tab Preview addon to see how this is done.

提交回复
热议问题