The method only works on the visible tab in each window, rather than for all tabs. The ID argument is window, rather than tab. Try: (untested, and will need window permission as well as tab permission)
chrome.windows.getAll(null, function(windows) { for (var i = 0; i < windows.length; i++) { chrome.tabs.captureVisibleTab(windows[i].id, function(dataUrl) { document.getElementById('body').innerHTML += '<img src="'+dataUrl +'" />'; }); } }); chrome.windows.getAll(object getInfo, function callback) On Sat, Dec 12, 2009 at 10:22 PM, Tom <tom.extensi...@googlemail.com> wrote: > This is the code snippet > > chrome.tabs.getAllInWindow(null, function(tabs) { > for (var i = 0; i < tabs.length; i++) { > chrome.tabs.captureVisibleTab(tabs[i].id, > function(dataUrl) { > document.getElementById('body').innerHTML += '<img > src="'+dataUrl > +'" />'; > }); > } > }); > > then in the body section there is a div tag like this > > <div id="body"></div> > > And its not capturing flash content. > > Tom > > On Dec 12, 9:41 pm, Mohamed Mansour <m...@chromium.org> wrote: >> Can you show a code snippet on what your are doing? Maybe the screenshot you >> are having is flash content (which it doesn't currently support)? Maybe the >> tab is invalid. >> >> -Mohamed Mansour >> >> >> >> On Sat, Dec 12, 2009 at 4:20 PM, Tom <tom.extensi...@googlemail.com> wrote: >> > Thanks Mohamed, >> >> > It all seems to be working, how ever the images are appearing blank. >> > They are 1440x780 and in inspector there are no errors reported. Even >> > when capturing the current window the images appear blank. >> >> > Tom >> >> > On Dec 12, 8:52 pm, Mohamed Mansour <m...@chromium.org> wrote: >> > > Hi Tom, >> >> > > You are placing the wrong thing in the source attribute: >> >http://code.google.com/chrome/extensions/tabs.html#method-captureVisi... >> >> > > <http://code.google.com/chrome/extensions/tabs.html#method-captureVisi.. >> > .>The >> > > callback function for captureVisibleTab has this defined as: >> > > "function(string dataUrl) {...})" >> >> > > You would use the "dataUrl" to assign the 'src' property of an HTML >> > Image >> > > element for display. >> >> > > An example being: >> >> > > <script> >> > > chrome.tabs.captureVisibleTab(null, function(dataUrl) { >> > > content = document.getElementById('screenshots'); >> > > var image = document.createElement('img'); >> > > image.setAttribute('src', dataUrl); >> > > content.appendChild(image);}); >> >> > > </script> >> >> > > <span id="screenshots"></span> >> >> > > -Mohamed Mansour >> >> > > On Sat, Dec 12, 2009 at 11:55 AM, Tom <tom.extensi...@googlemail.com> >> > wrote: >> > > > Is it supposed to be used like this? >> >> > > > var visualTab = chrome.tabs.captureVisibleTab(20, function(capture) >> > > > {});); >> > > > document.getElementById('content').innerHTML += '<img src="'+visualTab >> > > > +'" />'; >> >> > > > Thats what I'm doing at the moment and I can't get it to work. (I'm >> > > > sure 20 is a valid tab id) >> >> > > > Please could someone tell me what I'm doing wrong. >> >> > > > Thanks >> >> > > > -- >> >> > > > You received this message because you are subscribed to the Google >> > Groups >> > > > "Chromium-extensions" group. >> > > > To post to this group, send email to >> > chromium-extensi...@googlegroups.com. >> > > > To unsubscribe from this group, send email to >> > > > chromium-extensions+unsubscr...@googlegroups.com<chromium-extensions%2Bunsu >> > > > bscr...@googlegroups.com><chromium-extensions%2Bunsu >> > bscr...@googlegroups.com> >> > > > . >> > > > For more options, visit this group at >> > > >http://groups.google.com/group/chromium-extensions?hl=en. >> >> > -- >> >> > You received this message because you are subscribed to the Google Groups >> > "Chromium-extensions" group. >> > To post to this group, send email to chromium-extensi...@googlegroups.com. >> > To unsubscribe from this group, send email to >> > chromium-extensions+unsubscr...@googlegroups.com<chromium-extensions%2Bunsu >> > bscr...@googlegroups.com> >> > . >> > For more options, visit this group at >> >http://groups.google.com/group/chromium-extensions?hl=en. > > -- > > You received this message because you are subscribed to the Google Groups > "Chromium-extensions" group. > To post to this group, send email to chromium-extensi...@googlegroups.com. > To unsubscribe from this group, send email to > chromium-extensions+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/chromium-extensions?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Chromium-extensions" group. To post to this group, send email to chromium-extensi...@googlegroups.com. To unsubscribe from this group, send email to chromium-extensions+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/chromium-extensions?hl=en.