I have created some files in the "reality" format using Apple’s Reality Composer app for iOS. I had a difficult time figuring out how to implement it on the web. After looking at some webpages that include USDZ files on them, I finally put this into my site (links slightly changed):
<a href="media/images/ar.reality" rel="ar">
<img src="media/images/image.png" />
</a>
This works just fine in iOS/iPadOS Safari, but not so much in other browsers such as macOS Safari, Firefox, etc. When you click on the link in these browsers, it wants to download the reality file. I want to write a script in JS that will add anchor tags only when the browser supports USDZ or reality files. Is there a good way of doing this?
Edit:
The InstaPot site is a good example. They have an anchor tag to a USDZ file on iOS/iPadOS Safari, but they don’t on macOS Safari or other third party browsers.