Open CopperBadger opened 9 years ago
Thanks for tackling this Kobi! I'm thinking of moving your work with preview popovers into its own script so we can port the functionality to other parts of the site-- it would help free up space in the comment script in addition to improving UX :)
Before that happens though, there is a problem with some URLs that return HTML instead of images (user WeeverWolf posted a Dropbox link in this submission that does this (NSFW) http://www.furaffinity.net/view/15629468/). We unfortunately can't use AJAX to grab the OpenGraph image that we'd need to solve this issue because of cross-origin restrictions (unless you know of a way we could get around that; that would be wonderful)-- would it be possible to have the script detect if a loading error occurs and display a "sorry" message in the popover?
We could write an external PHP script to pass the URL to and determine if we can grab it. Make this script have an Access-Control-Allow-Origin
to get around sites that don't allow embedding, if possible. For sites that we need to grab images differently, we can work those out based on the domain. Once we know how to get the image, encode it and return the appropriate document type header.
We can also look at how some extensions that do this kind of thing browser-wide such as Imagus
Ex: http://www.furaffinity.net/view/15629464/ , someone posted a link to a gif in the comments, would be nice to have a preview for it