2

I have seen this excellent firefox extension, Screengrab!. It takes a "picture" of the web page and copies it to the clipboard or saves it to a png file. I need to do so, but with a new web page, from an url I have in javascript. I can open the web page in a new window, but then I have to call the extension -not to press the control- and saves the page once the page is fully loaded.

Is it possible?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Alfredo Yong
  • 976
  • 8
  • 11

2 Answers2

1

I am pretty certain that it is not possible to access any Firefox add-on through web page content. This could create privacy and/or security issues within the Firefox browser (as the user has never given you permission to access such content on their machine). For this reason, I believe Firefox add-ons run in an entirely different JavaScript context, thereby making this entirely impossible.

However, as Dmitriy's answer states, there are server-side workarounds that can be performed.

Jon Newmuis
  • 25,722
  • 2
  • 45
  • 57
0

Does not look like ScreenGrab has any javascript API.

There is a PHP solution for Saving Web Page as Image.

If you need to do it from JavaScript (from client side) - you can:

Step 1: Create a PHP server app that does the trick (see the link), and that accepts JSONP call.

Step 2: Create a client side page (JavaScript) that will send a JSONP request to that PHP script. See my answer here, that will help you to create such request.

Community
  • 1
  • 1
Scherbius.com
  • 3,396
  • 4
  • 24
  • 44