Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
123
rated 0 times [  125] [ 2]  / answers: 1 / hits: 29458  / 11 Years ago, wed, december 25, 2013, 12:00:00

I have a payment form in which user can enter all his card details,and when he clicks,he is taken to the banks 3D secure page. But,the problem is, the user can simply click on the back button of the browser and can go back to payment page, if he initiates a pay now again,there is a chance of multiple transaction and duplication of ref ids.



So my question is: is there some way I can redirect the user to a custom page when he clicks on back button which says Session expired, so transaction has been cancelled. so that we avoid duplication of ref ids?


More From » php

 Answers
15

Use the below jquery for redirect your own url when clicking browser back button
andipedia.com



   jQuery(document).ready(function($) {

if (window.history && window.history.pushState) {

$(window).on('popstate', function() {
var hashLocation = location.hash;
var hashSplit = hashLocation.split(#!/);
var hashName = hashSplit[1];

if (hashName !== '') {
var hash = window.location.hash;
if (hash === '') {
alert('Back button was pressed.');
window.location='www.example.com';
return false;
}
}
});

window.history.pushState('forward', null, './#forward');
}

});

[#73556] Monday, December 23, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
breap

Total Points: 606
Total Questions: 96
Total Answers: 108

Location: Djibouti
Member since Sun, Feb 27, 2022
2 Years ago
breap questions
Thu, Jun 24, 21, 00:00, 3 Years ago
Wed, Mar 18, 20, 00:00, 4 Years ago
Mon, Oct 7, 19, 00:00, 5 Years ago
;