So clip to OneNote and other clipping extensions can screenshot everything on the page including content in an iframe. Does anyone know how they do that? I figure it's some sort of javascript functionality. When I tried to use html2canvas, they said it wouldn't be possible to grab the iframe. As far as security issues go, this screenshot would be rendered clientside.

2

There are 2 answers

2
Daniel Herr On BEST ANSWER

You can use the captureVisibleTab api with the "<all_urls>" permission.

"Captures the visible area of the currently active tab in the specified window."

chrome.tabs.captureVisibleTab(
 chrome.windows.WINDOW_ID_CURRENT,
 { format: "png" || "jpeg" },
 function(dataurl) {
  console.log(dataurl)
 }
)

https://developer.chrome.com/extensions/tabs#method-captureVisibleTab

0
layonthebeech On

Answered above

developer.chrome.com/extensions/tabs#method-captureVisibleTa‌​b