ile angularjs kullanıyorsanız:
http://jordanhollinger.com/2012/06/08/disable-the-back-button-using-html5/
Ama bu AngularJS arka planda URL_Hash # kullandığı için yukarıdaki kod AngularJS ile iyi çalışmaz, bu yüzden burada nasıl dönüş yapabileceğinizi göstereceğim:
Ana Javascript Kodunuzda (AngularJS Kodu veya kontrolcü içinde değil) aşağıdaki kodu girin : En angularjs Denetleyici şu olay Listner koymak
// *** Author: Wael Sidawi
// **** Deactive Back Button ****
var history_api = typeof history.pushState !== 'undefined';
// history.pushState must be called out side of AngularJS Code
if (history_api) history.pushState(null, '', '#StayHere'); // After the # you should write something, do not leave it empty
Ve hemen içeri:
/**
* Event-Listner for Back-Button
*/
$scope.$on('$locationChangeStart', function(event, next, current){
// Here you can take the control and call your own functions:
alert('Sorry ! Back Button is disabled');
// Prevent the browser default action (Going back):
event.preventDefault();
});
Ben size yardımcı olabilecek umut.
Saygılarımızla
Wael sizin angularjs kısmı için
, sadece bu makaleye http://stackoverflow.com/questions/15813850/detect-history-back-using-angular kullanmak, bir grup vardır benzer sorular bunu hemen sonrası yok ... –
@FerTo http://stackoverflow.com/help/self-answer –