Explain Codes LogoExplain Codes Logo

Apple Touch Icon for Website

html
apple-touch-icon
favicon-generator
cross-platform
Alex KataevbyAlex Kataev·Aug 6, 2024
TLDR

Add an Apple Touch icon to your website code with this line of HTML in the <head> section:

<!-- It's Apple season. Let's prep the harvest! --> <link rel="apple-touch-icon" href="/apple-touch-icon.png">

Remember to size your icon 180x180 pixels. This dimension allows the icon to be auto-scaled to fit any Apple device screen. Place the icon image, named apple-touch-icon.png, at the root directory of your website for global access.

Icon resolution considerations

The simplest approach is creating a single, high-resolution icon. A 180x180 pixels icon, for example, can be scaled down by Apple devices to fit any screen size. This practice reduces the number of HTTP requests, making your site faster.

Important design guidelines

When designing your icon, consider that iOS may add some visual effects to it. To avoid surprises, stick to the Apple's design guidelines. They will ensure your icon feels at home on an Apple device.

Declaring the Apple Touch icon

By including <link rel="apple-touch-icon" href="/path/to/apple-touch-icon.png"> in your HTML's <head>, you're explicitly setting the Apple Touch icon for your website. Save the icon in the root directory (or specify a custom path). This makes it easy for devices to find and display your icon.

The power of favicon generators

Consider using a favicon generator, like RealFaviconGenerator, to create your icons. These tools can generate a ready-to-use set of icons with various sizes and format, saving you from the hassle.

Coping with iOS 7 and older

Since iOS 7, Apple abandoned the precomposed tag (apple-touch-icon-precomposed). Gloss effects are no longer applied automatically, so you don't need to account for them in your design. Keep it simple and control your icon's final appearance.

Don't forget Android and Chrome

While creating a splendid icon for Apple, ensure it's compatible with Android/Chrome. These platforms also search for touch icons, so you'll want them to find the right one. Universal compatibility is key to a successful website look and feel.

Keep up with technology

Tech is always changing. Make sure to check the latest guidelines from Apple before starting your icon design. This will ensure your icon looks awesome on all new devices.

Seamless cross-platform experience

Don't get so focused on Apple devices that you forget about Android/Chrome. Many of the same principles apply to both platforms. Maximize compatibility, and you'll maximize your audience.

Fine-tuning for different devices

Using the sizes attribute in your link tag, you can provide different icons for different devices:

<!-- Because one size doesn't fit all --> <link rel="apple-touch-icon" sizes="120x120" href="/path/to/icon-120.png">

This tailored approach ensures each device can display a perfectly sized icon, without needing to scale your image.

Extra features for an enhanced user experience

Go the extra mile for your Apple users. Use apple-mobile-web-app-title to give a custom title on the home screen, and apple-touch-startup-image to set a custom startup screen. These details can make your website feel like a native app.

Staying current with updates

Keep an eye on the latest updates from Apple. Remember to check for updated specifications from time to time for a seamless user experience.

References