How to redirect it to homepage instead of showing this in new tab.
FutureUltron opened this issue · 1 comments
FutureUltron commented
bbowers-hawaii commented
What worked for me was:
-
set the Web App access/auth, "Who has access" to Anyone.
you can do this in appscript by clicking Deploy, Manage Deployments, edit -
then in your html file after closing tag.
<script>
window.addEventListener("load", function() {
const scriptURL = '<YOUR SCRIPT URL>'
const form = document.getElementById('id of your form');
form.addEventListener("submit", function(e) {
e.preventDefault();
const data = new FormData(form);
fetch(scriptURL, {
method: 'POST',
body: data,
mode: 'no-cors', // unsure if this is needed since access changed to anyone
})
.then(() => {
window.top.location.href = 'your page url';
})
});
});
</script>