retina.js method and S3/CDN
-
I have WP Retina running and coexisting with the “Amazon S3 and CloudFront” plugin. Using the HTML Rewrite method it works fine. But using the retina.js method, nothing happens. The script is loading fine.
I looked into the code for retina.js, and found the issue. Retina.js looks for the 2x method with an XMLHttpRequest HEAD call, which is blocked for differing domains as per the browser’s cross-site-scripting rules (this check is done in retina.js in
RetinaImagePath.check_2x_variant()
andRetinaImagePath.is_external()
.The only solution I can think of is that the WP Retina plugin would add a data-tag to the img tag saying “I know for sure the 2x version of this exists, you don’t need to bother looking for it”, and add code to retina.js to bypass the XHR request if it’s present. This would have the bonus of halving the latency for same-domain users as well.
– Karl
- The topic ‘retina.js method and S3/CDN’ is closed to new replies.