I am trying to show a success popup after page load and if user press android back button ( which is in this case equivalent to browser back button ) I only want to close the popup ( don't want to redirect back on payment page )
I am adding hash in url when popup is open but when user press back button chrome ignore the hash and redirect back on previous page instead of just removing the hash ( working fine in Firefox )
I have a working example here
a) open this page in chrome
b) wait till hash is changed to '#c'
c) then press browser back button
expected behavior is it should change the hash back to '#b' and then back to '#a' but it ignore all the hash changes and redirect back to new-tab page
This is the code
window.location.hash = 'a';
setTimeout(function() {
writeLength();
window.location.hash = 'b';
setTimeout(function() {
writeLength();
window.location.hash = 'c';
setTimeout(function() {
writeLength();
}, 1500);
}, 1500);
}, 1500);
how can I simulate the correct behavior (if there is any way) ?
I am using chrome Version 77.0.3865.90 (Official Build) (64-bit) on Mac
here is a GIF image of behavior
from changing window.location.hash creates entry in history but doesn't affect chrome back button
No comments:
Post a Comment