I noticed on the Forbes website the back button was disabled until the second click. Not a double click.
I was wondering where I could find a script like this?
Thanks!
I noticed on the Forbes website the back button was disabled until the second click. Not a double click.
I was wondering where I could find a script like this?
Thanks!
Hi @Freejoy,
this is not too complicated, maybe something along the lines of:
function goBackButton() {
var button = document.getElementById('myBackButton');
var hasBeenClicked = false;
button.addEventListener('click', function(event) {
if (!hasBeenClicked) {
hasBeenClicked = true;
event.preventDefault ? event.preventDefault() : (event.returnValue = false);
}
});
}
Hope it helps.
Thanks Andres
I meant the browsers back button.
I see, then my best guess is that it is something related to window.history.pushState where you are able to manage url history with JavaScript without reloading the page
Off Topic:
Messing with the normal functioning of the browser confuses and annoys visitors. Is there a compelling reason you need to do this, which can’t be accomplished by other means?
Yes, I’m compelled to have them see my exit popup. : )
I thought the was Forbes done it was very elegant.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.