javascript - react history replace disallow back button -


i know it's impossible technically disable user click button of browser, doesn't make sense time in our app allow kind of operation.

for example in job application app, after apply go next page,

this.props.applyjob({       id: this.state.selectedad_id,       applicant_id     }).then(response => {       if(response.value.status === 200){         const { id } = response.value.data.result         this.props.history.replace(`/job/applied/${id}`)       }     })  user still can go previous page doesn't make sense, how handle that? 

you try onunload function of sort. if user clicks button want them click have set variable dont warning message.

    var showalert= 1; // set show warning when leaving page      // if click next button add function     // showalert =0;  window.onbeforeunload = function(){     if (showalert == 1)   return 'please use next , previous buttons , not browser buttons ensure date saved.'; }; 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -