Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8423423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:43:09+00:00 2026-06-10T03:43:09+00:00

I’ve been working on a redirect page that sits between an ad and the

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:43:10+00:00Added an answer on June 10, 2026 at 3:43 am

    I ended up choosing to do a two stage redirect. User clicks a banner and gets directed to:

    http://myserver.example.com?someKey=someValue
    

    I have a function that does this:

    // Do I have a visited param?
    if ($.url(window.location.href).param('visited') === '1') {
        // Do I have a visited cookie?
        if (helper.retrieveCookie('VISITED') == undefined) {
            console.log('Setting visited cookie');
            helper.storeCookie('VISITED', '1');
            return 1; // Redirect to AppStore.
        }
        // Have param and cookie
        console.log('VISITED cookie set');
        console.log('Refreshed');
        return 2; // Don't redirect.
    } else {
        // No param
        helper.removeCookie('VISITED');
        return 0; // Redirect to self with &visited=1
    }
    

    So basically we will pass through the code twice meaningfully and N times subsequently due to refreshes. During the first pass we do our AJAX request, then redirect to ourself with an added param. During the second pass we set a cookie and redirect to the AppStore. Any subsequent load of the page will have both a cookie and a param and won’t redirect. New banner clicks will not have the param so they will perform normally.

    This isn’t the most beautiful solution since we have to reload our redirect page, but since its contents should be cached, the hit should be minimal.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am doing a simple coin flipping experiment for class that involves flipping a
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.