Close popup by clicking the back button

Asked

Viewed 138 times

-1

Is there any way to detect the "back" click? More necessarily from mobile devices (Android is enough).

I would like, in my web app, the back button can call certain functions, in this case close popups. Do you have any idea?

1 answer

0

You can try using the function:

document.addEventListener("backbutton", onBack, false)
function onBack(){ /* faz algo ao clicar no botão voltar */ }
  • didn’t work :( you already tested it?

  • worse, that yes I use it in my app, some error?

  • if you manage to post the code part, tbm would help a little

  • I found a way!! but I’m not able to duplicate it to use more than one popup. I’ll put her link in jsfiddle, if you want to try it would be great!

  • and on your question, no mistake, just exit the web app without calling the function

  • https://jsfiddle.net/Limitlessisa/axt1Lqoz/

  • all I need is that, like, the "share" button can be duplicated and each open a different popup and close their respective ones. when I tried this one of them always ends up losing the effect and I don’t understand why

  • Hello I made a fast way here, https://jsfiddle.net/3e5dgo0j/1/ see if that’s it, only missing when you click a exit, and you can slow down the effect tbm, I didn’t understand if that’s what you wanted.

Show 3 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.