Hi! When adding a generator page to the iOS Home Screen (“Add to Home Screen”), the icon is always the default site icon, even though the generator has a custom $meta.image (which correctly shows up in the share sheet via og:image). Could you please use the generator’s $meta.image as the apple-touch-icon (and favicon) for generator pages, falling back to the default when a generator has no custom image? Thanks!

  • Nexora
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    6 days ago

    meta image is different from favicon, you can set favicon in index by

    <link rel="icon" href="https://user.uploads.dev/file/b0ce7dfdd9a156ca27d2c3c3dc1a3940.jpg">
    <link rel="apple-touch-icon" href="https://user.uploads.dev/file/b0ce7dfdd9a156ca27d2c3c3dc1a3940.jpg">
    <script>
    (function(){
      const fav = document.querySelector('link[rel="icon"]');
      const apple = document.querySelector('link[rel="apple-touch-icon"]');
      if(fav && !document.head.querySelector('link[rel="icon"]')) document.head.appendChild(fav);
      if(apple && !document.head.querySelector('link[rel="apple-touch-icon"]')) document.head.appendChild(apple);
    })();
    </script>
    

    but a I have suggestion for devs, add favicon = to meta and add it to api so for example recently updated generators list or similar lists can get and show generator favicon from api so they don’t need to fetch index and search for it in index to show it.

    • FeebieOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      5 days ago

      Thanks for the reply! Just one clarification: those <link> tags in index.html end up in the <head> of the game iframe (<publicId>.perchance.org/<name>), and iOS “Add to Home Screen” reads the icon of the top-level document (perchance.org/<name>), which has the platform’s default apple-touch-icon.png. The frame can’t touch the top document’s head (cross-origin — SecurityError), so the snippet changes the icon inside the frame but the Home Screen icon stays the default cube. I verified this: Share sheet picks up og:image fine, Home Screen doesn’t.

      So the snippet doesn’t solve it — only the platform can, by rendering the generator’s $meta.image (or a new $meta.favicon, per your suggestion, which I support) as the apple-touch-icon of the generator’s top-level page, with fallback to the default. That would fix it for all generators at once.

      • Nexora
        link
        fedilink
        English
        arrow-up
        2
        ·
        5 days ago

        I just noticed you can set $meta.icon:

        $meta
          title = 
          description = 
          tags = 
          image = https://user.uploads.dev/file/
          icon = https://user.uploads.dev/file/
          header
            mode = minimal
        

        I believe this is new.