I've been working on a redirect page that sits between an ad and the app store. The ad exists as a static URL that directs to the redirect page. The redirect page sends an ajax request to a third party, sets a cookie, then redirects to the AppStore. All well and good and not uncommon.
The redirect page cannot close itself so it remains as a tab in Safari. The issue I'm having is that when the user returns to Safari if the page is been purged from the cache, Safari will reload it triggering the redirect. I do not want the users getting thrown into the AppStore unexpectedly.
One solution would be to check for the presence of a cookie and not redirect if it's presence, but this leaves the edge case of the user clicking on another banner ad and not getting the appropriate redirect. I've tried appending an anchor to the URL which prevents user initiated refreshes, but the auto-refresh mechanism of Safari does not respect the programmatically added hash.
If I could use a dynamic source to generate the URL that directs the user to the page I could generate a timestamp, but right now the origin URL is static. Does anyone have a solution for this using client side code? Or is this really only solvable using a server-side solution?