公共js:
export const disableBrowserBack = (param) => {
return (function () {
history.pushState(null, null, document.URL);
if (window.history && window.history.pushState) {
$(window).on('popstate', function () {
window.history.pushState('forward', null, '');
window.history.forward(1);
});
}
//
window.history.pushState('forward', null, '');
window.history.forward(1);
})()
};
页面引入使用:
import {disableBrowserBack} from '../../util/util'