our react application redirecting to third party url(using window.open ) and that third party url is hitting 3-4 other url and once process completed it is redirect to our own url (React app). now from here if user click browser back button it’s again navigating to that previous all third party url that i dont want
to resolve this issue –
- i used "replace" from react router, its replacing only current url not all previous url
- cann’t use iframe – that third party url not suitable for iframe
- window.history.replaceState("","",url)- not working- if i go back still navigating to third party url
2
Answers
First use "window.history.pushState" when your opening a third part url. Then call "window.history.replaceState" this replaces the current history entry with the final successful redirection URL. This ensures that clicking the back button only goes back to the previous state within your React app.
There is nothing you can do about that.
You cannot control the history state of someone else’s website.