add-to-homescreen icon indicating copy to clipboard operation
add-to-homescreen copied to clipboard

Icon selection seems a bit weak

Open nuthinking opened this issue 9 years ago • 0 comments

Looks like with document.querySelector the first icon matching the various options gets returned. This doesn't guarantee that it is the one at the highest resolutions.

For my web app, because I knew the metadata defined, I modified that logic to this:

if ( !this.applicationIcon ) {
    if ( ath.OS == 'ios' ) {
        var retina = (window.devicePixelRatio > 1);
        var isIPhone = (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i));
        var size = (isIPhone ? (retina ? "120x120" : "57x57") : (retina ? "152x152" : "76x76"));
        this.applicationIcon = document.querySelector('head link[rel^=apple-touch-icon][sizes="' + size + '"]');
    } else {
        this.applicationIcon = document.querySelector('head link[rel^="shortcut icon"][sizes="196x196"]');
    }
}

Any opinion on how something along these lines could be integrated in the library?

nuthinking avatar Jun 03 '15 12:06 nuthinking