<form action="index.html" method="get"> <input type="text"> <input type="checkbox"> <input type="radio"> <select> <option value="foo">foo</option> <option value="bar">bar</option> </select> <hr> <input type="submit" value="送信"> </form>
window.addEventListener('beforeunload', function() { var msg = 'このページから移動すると入力フォームの内容が消えます。'; e.returnValue = msg; });