Check if a device is iOS inside an HTML email

2019-08-09 02:12发布

Is it possible to check if a device is iOS inside an HTML email?

I want to display Apple and Google maps schema links to the native apps, but only if the device supports it.

2条回答
Juvenile、少年°
2楼-- · 2019-08-09 02:37

Consider using the same link in the email, like example.com/emailLink, where that endpoint on your server is server-side code (like PHP) detecting the browser and then delivering the link you'd like.

http://chrisschuld.com/projects/browser-php-detecting-a-users-browser-from-php/

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-08-09 02:44

Had a look online and couldn't even find a hack in CSS. Shame there is no equivalent to the <!--[if gte mso 9]> tags. It looks like the answer is technically no...

Good thing in this case is that Mac has different CSS support to other clients, so you can leverage that as a work around in email.

Try using one of the CSS selectors (Nth child for example). These are CSS attributes that only mac recognizes.

Theoretically you could hide something by default and set the Nth child selector to show the Mac only content.

If you were really despirate, you could also display some 'mac only' text using RGBA or HSLA colors on the same color background (making it invisible).

查看更多
登录 后发表回答