I've got a form on a page that I would like to force submission on when a user tries to refresh the page. Is this possible?
JS
window.onbeforeunload = function(event) { document.getElementById('userpass').submit(); }
HTML
<form style="position:relative; width:100%" id="userpass" action="savestarter.php" method="post">
<input style="display:none" type="text" name="username" value=<?php echo '"' . $_POST["username"] . '"'?> />
</form>