iMessage URL - 使用 JavaScript 动态更改网站图标

问题描述 投票:0回答:0

我有一个根据主机名标记的 Web 应用程序,并且根据网页主机名更新网站图标。

当网页的 url 作为 iMessage 发送时,消息显示默认图标而不是动态设置的图标。当网页 url 作为 iMessage 发送时无法读取主机名。

HTML:
<link rel='icon' id="appIcon" type='image/x-icon' href=''>

SCRIPT:
favIcon = document.querySelector('#appIcon');

if (host.includes('light.org')) {
  favIcon.href = 'https://www.light.org/favicon.ico';
} else {
  favIcon.href = 'https://www.dark.org/favicon.ico';
}

当 url https://www.light.org 作为 iMessage 发送时,显示深色图标而不是浅色图标。

有没有办法从 iMessage 读取主机或 url 并动态设置图标?

javascript reactjs angular favicon imessage
© www.soinside.com 2019 - 2024. All rights reserved.