Search code examples
iosswiftthumbnailsnsurl

How To Get External URL thumbnail iOS


i want to present a URL for example (http://edition.cnn.com/) with a thumbnail image from the site

do i need to Use Web View or try to extract images from the HTML, or there is a better solution ?

thanks.


Solution

  • It depends on what you want to see in the thumbnail image.

    If you want to see a rendered preview of the site, then loading the page on a web view and taking a screen shot of that could be a way to go.

    If you want to present an icon instead, you could load the source and scan it for a meta tag that contains the site's icon image. (such as og:image for example) and then download that.