I need to Disable Submit button(s) on the page when browser's back button is clicked. This should be generic meaning in which ever page I place this script, it should disable all the Submit buttons on that page when the user hits the browsers back button.
单击浏览器的后退按钮时,我需要在页面上禁用“提交”按钮。这应该是通用的意思,在该页面中我放置此脚本,当用户点击浏览器后退按钮时,它应禁用该页面上的所有提交按钮。
1 个解决方案
#1
0
You should be able to achieve that using window.history.pushState and popstate (See below sample). For compatibility refer to this
For complete documentation refer to this
您应该能够使用window.history.pushState和popstate来实现它(参见下面的示例)。有关兼容性,请参阅此内容。有关完整文档,请参阅此
jQuery(document).ready(function ($) {
if (window.history && window.history.pushState) {
window.history.pushState('forward', null, null);
$(window).on('popstate', function () {
//Add logic here
});
}
});
#1
0
You should be able to achieve that using window.history.pushState and popstate (See below sample). For compatibility refer to this
For complete documentation refer to this
您应该能够使用window.history.pushState和popstate来实现它(参见下面的示例)。有关兼容性,请参阅此内容。有关完整文档,请参阅此
jQuery(document).ready(function ($) {
if (window.history && window.history.pushState) {
window.history.pushState('forward', null, null);
$(window).on('popstate', function () {
//Add logic here
});
}
});