I have an hybrid iPad app loading html and javascript in a webview.
All the images are ok in ipads 1 and 2s but fuzzy in ipads 3.
I was thinking about some possible solutions:
- Serve 2x images and show them at 50% in low res ipads.
- Detect retina display and serve different images
How would you manage the different resolutions and image loading in different devices?
You can use Javascript to swap LowRes images to HiRes images on HiRes devices. There is a JQuery plugin that does that. Apple is using this method (not the JQuery plugin) for its own pages, so it should not be too bad.
You could use another method if you can change your inline
<img>
to CSS background images. Then you can use media queries to serve HiRes images to HiRes devices:I've named the HiRes image with the iOS
@2x
suffix, although that is not necessary.I would not serve full resolution images to LowRes devices as that would increase the size of the images and thus the loading time for LowRes devices without any benefit.
If you can detect HiRes devices on your server side and then serve the best resolution images for the requesting device, that would be the best way IMHO.