2

I need some help here.

I want to do some action when a user clicks the browser back/forward button. But I am getting how to detect the browser button clicks or not. I am using react-native. Can anyone help me out? like which package I should use or with pseudo code? Thank You.

Rich
  • 155
  • 1
  • 8
  • 23
  • see that same issue .[link](https://stackoverflow.com/questions/47936566/detect-button-click-from-webview-in-react-native) that's maybe helpful:) – Meisan Saba Nov 25 '20 at 07:55
  • @MeisamSaba thanks for the replay, I don't want any extra button. I just want to detect the browser back/forward button(located in the left corner of the browser) click. – Rich Nov 25 '20 at 08:10
  • u can set `window.postMessage("Hello React", "*");` on back/forward button `onclick` function . I guess that possible. – Meisan Saba Nov 25 '20 at 08:26
  • You provided very little detail, but I assume you may be looking for something like that: https://stackoverflow.com/questions/55122592/how-do-i-go-back-in-webview-i-am-using-the-react-navigation-package-in-react-na/57441046#57441046 – Lukasz Dec 03 '20 at 13:43
  • @Rich Are you using the Linking module from RN or wanted to detect a button from Webview? – Waheed Akhtar Dec 04 '20 at 19:25
  • You should give more details because the browser context with RN is kind a confusing. – Diego Molina Dec 04 '20 at 19:38
  • did you looked at these answers: https://stackoverflow.com/questions/25806608/how-to-detect-browser-back-button-event-cross-browser – Abilogos Dec 05 '20 at 21:27

0 Answers0