Redirect To A New Page
Keeping the current page in history (for Back button)
<script>
window.location = "https://somedomain.com";
//window.location = "/some_page?MyArg1=' + encodeURIComponent(MyArg1Value);
</script>
Don’t keep the current page in History (Back button won’t return to it)
<script>
window.location.replace("https://somedomain.com");
//window.location.replace("/some_page?MyArg1=' + encodeURIComponent(MyArg1Value) );
</script>
Redirect With POST Data Using A Hidden Form
Include the hidden form with the values you want to send on the page:
<!-- ----------------------------------------------- -->
<!-- HIDDEN FORM AUTO SUBMITTED ON UPLOAD COMPLETION -->
<!-- ----------------------------------------------- -->
<form id="form_upload_complete" name="form_upload_complete" method="post" action="http://www.mydomain.com/successful_upload.php">
<input type="hidden" name="field1" value="some value" />
<!-- etc... -->
</form>
Then in your javascript use
document.forms["form_upload_complete"].submit();
Open page in a new browser tab
Use window.open() instead of assigning to window.location()
<script>
window.open("https://somedomain.com", "_blank");
</script>";
Go Back To Previous Page
history.go(-1);
