2017-09-12 12 views
1

私は技術的にはブラウザの戻るボタンをクリックすることを無効にすることは不可能だと知っていますが、私たちのアプリではこの種の操作を許可しています。私の仕事のアプリケーションのアプリで例えば反応履歴入れ替え戻るボタンを無効にする

、あなたは次のページに移動適用した後、

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}`) 
     } 
    }) 

but user still can go to the previous page which doesn't make sense, how to handle that? 

答えて

0

あなたはある種のONUNLOAD機能を試すことができます。ユーザーがクリックしたいボタンをクリックすると、警告メッセージが表示されないように変数を設定する必要があります。

var showAlert= 1; // this is set to it will show warning when leaving the page 

    // if they click your next button add this to a function 
    // showAlert =0; 

window.onbeforeunload = function(){ 
    if (showAlert == 1) 
    return 'Please use the Next and Previous buttons and not the browser back buttons to ensure your date is saved.'; 
}; 
+0

これはブラウザにハックするためのものですが、お勧めしません –

関連する問題