Skip to content

Instantly share code, notes, and snippets.

@subak
Created June 18, 2012 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subak/2948239 to your computer and use it in GitHub Desktop.
Save subak/2948239 to your computer and use it in GitHub Desktop.
エントリー作成中にブラウザの「戻る」を防ぐ
(function() {
$(function() {
var $action;
$action = $("[name^='ACMS_POST_Entry_Insert'], [name^='ACMS_POST_Entry_Update']");
if (0 !== $action.size()) {
window.onbeforeunload = function() {
return "エントリーを編集中にページを離れると保存できない場合があります。よろしいですか?";
};
return $($action[0].form).submit(function() {
return window.onbeforeunload = null;
});
}
});
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment