📜 ⬆️ ⬇️

Take a screenshot of the site yourself and give it to others

I'll be brief. There are a lot of services and features that need screenshots of other sites, such as various directories, search engine ranking checkers, subscriber previews, pop-up tips, etc. In the general case, something accesses the site, loads its page, somehow generates a screenshot and sends it to the requester. Now most often used third-party services, which is enough to turn on a specially created url and get a screenshot of the site in response.

But why all this is not done easier, more economical and predictable?

Screenshot generators often do not show previews immediately, because I don’t want to download them. Screenshots are often made once a day, a month, or even for years stuck in all sorts of caches, and webmasters cannot influence the situation. I suggest that site owners take screenshots of their own sites and give them to people.
The scheme is as follows. The webmaster manually or programmatically generates a screenshot of the site as it sees fit and puts it into http access, indicating the presence of a screenshot with a special meta tag. To do this, you can use an existing LINK tag, in the manner of favicon:

<link rel="screenshot" type="image/jpeg" title=" " href="http://example.com/path/to/screenshot.jpeg" /> 

The tag is added to the HEAD section of the document, along with other meta tags that point to other resources associated with the page - css, favicons, etc. To get a screenshot, just extract the href parameter and load the file (or display it in the img tag), taking into account its mime -the type specified in the type parameter (after all, a screenshot can be made in jpeg, in png, and in svg).



Criticism is required.

Source: https://habr.com/ru/post/104452/

All Articles