0

To take a snapshot of a page, I'm using the method visibleContentsAsDataURL() from the Safari extension API (based on the Snapper Safari extension ).

Oddly, the method only get a snapshot of the top of the page.

I'm using a event mechanism to scroll the page and take several snapshots then combine them. The resulting image is the top of the page repeatedly...

Is anyone aware of this problem ? Is there any constraint to the visibleContentsAsDataURL() ?

xurei
  • 1,057
  • 8
  • 22

2 Answers2

2

Accidentally I come up with the solution for this problem:

var dataUrl = safari.application.activeBrowserWindow.activeTab.visibleContentsAsDataURL();
if(dataUrl){
    callback(dataUrl);
} else {
    safari.application.activeBrowserWindow.activeTab.visibleContentsAsDataURL(callback);
}

Don't ask why and how but it does work. Bug in safari or in extension documentation.

1

This is a known bug in Safari. I've already filed an issue, as have others, but they have yet to fix it. You should file an issue with Apple to bump the priority.

allisonh
  • 53
  • 6
  • Thanks, allisonh. Is there any tracker for Safari bugs, so that I don't have to mail them... – xurei Feb 13 '13 at 13:46
  • Unfortunately, there doesn't seem to be a way to browse their bugs list. You'll have to file a bug with them yourself, and then you'll only get a response that it is a duplicate. And I believe you need to do this with a Apple developer account, not 100% sure about that part. – allisonh Feb 15 '13 at 21:01