Will this help to control back-button?

One of the huge issues when running our app on a mobile device is the back-button that the user can use on his device.
I have tried using various js functions trying to disable this function but to no avail. Unfortunately it throws the app back to a no cache status, and really looks real nasty.
Would using the sc_url_exit(), and maybe put in a recovery url solve this issue. Id it does this would be a g-d send for many of us battling with sc in a mobile environment.

I use this code in the HTML template of the header and it fix the problem by creating 10 duplicate entry in the back history, so the back button return to the same location.

<script>                                           
window.onload = function() {
    var i=0;
    var previous_hash = window.location.hash;
    var x = setInterval(
    function(){                                                              
        i++;
        window.location.hash = "/noop/" + i;                                                  
        if (i==10) {
            clearInterval(x);                                                               
            window.location.hash = previous_hash;
        }                                                   
    },10);
}  
 
</script>
2 Likes

I think that Chromium has closed that loophole now? It’s not working for me.

What seems to be working is the following (more testing required):

if ( window.history.replaceState ) {
  window.history.replaceState( null, null, window.location.href );
}
1 Like