Detecting Incognito Mode on iOS 17+ Safari for Redirect Handling

143 Views Asked by At

We are facing an issue with our product's security feature, which involves using the 'fbclid' code in the URL. On iOS 17+ Safari, especially in incognito mode, Apple has disabled link trackers, causing redirection without the code, leading to a failure in accessing our product.

To reproduce the problem, you can use the following URL in incognito mode: "https://example.com/?fbclid=123". You'll notice that the URL changes to "https://example.com/" due to Apple's tracking and fingerprinting protection.

We are looking for a reliable method to detect whether the user is browsing in incognito mode and, based on this detection, provide an alternative URL.

We have already tried using a hidden iframe and checking the redirection from the iframe, but it didn't yield the desired result.

Any suggestions or solutions on how to detect incognito mode in iOS 17+ Safari would be greatly appreciated. Thanks in advance!

1

There are 1 best solutions below

1
Joe Rutkowski On BEST ANSWER

I've been maintaining a repo on GitHub to detect incognito mode using JavaScript for several years now. It works on all modern Safari versions up to the current 17.3.

https://github.com/Joe12387/detectIncognito