How to create an image of the website using js?

Can I "convert" the website to a JPG or GIF? I mean, is it possible to view the website as an image? (obviously without animation) only a static image, like a photo of the website that the user is seeing on the browser...

Thank you!

Answers:

Answer

No it is not possible, since the way the website looks is just how a browser renders it, it can be different sizes and there are many variables to the way your page looks. You can do it server-side using PHP but it won't be simple at all, it would mean your server has to have a browser that will generate the website, save it as an image on the server, and send it to the user.

Answer

Firefox added something similar to this to their canvas implementation. You can find CanvasRenderingContext2D.drawWindow() documented in their wiki. It is restricted to being used by plugins, for security purposes, and isn't supported by any other browsers.

There is talk of adding support to other browsers, and perhaps removing some of the security restrictions, but that is probably a long way off. For now, there isn't a good JavaScript solution to your problem.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.