The problem:
I need to start with a URL with a query string containing a URL of a second page - http://www.firstURL.com/?http://www.secondURL.com.  On the target page of the first URL, the query string is parsed to extract the second URL and the browser is re-directed to the second URL.  This is done on $(document).ready so that it's automatic.  This all works fine, but of course falls in a hole if the user hits the back button on the second URL.  Here's the basic code:
$(document).ready(function() {
    var s = location.search;
    if(s != '') {
        var split = s.split('?');
        var loc = split[1].replace('?', '');
        location.href = '' + loc + '';
    } else {
        //do something else on the target page..
    }
});
I've tried creating a conditional case where, if the referrer is the 2nd URL (loc in the code above), the re-direction doesn't execute, but it seems that in the case of a re-direction, the back button doesn't return the referrer.
I have to do all this client side - I have no access to the server.
Is there some way to prevent the re-direction triggering on a back button click? Thanks.
 
    