Brandon
Brandon

Reputation: 41

Cannot make POST request to self

I'm trying to get my Apps Script days-old web app to send POST data to itself. However, upon submitting the form, I get a SAMEORIGIN error. The weird thing is that I'm doing the exact same thing on another months-old GAS Web App with no issue...

<form action="<?= ScriptApp.getService().getUrl() ?>" method="post" id="loginForm">
<div class="input"><span class="label">Password:</span> <input type="password" name="password" id="password" required="required"></div>
<div class="input"><input type="submit" value="Log In"></div>
</form>

The same form is on my other web app, created a few months ago, and works just fine.

Upvotes: 0

Views: 106

Answers (1)

Brandon
Brandon

Reputation: 41

Found my error. This needs to be placed in the HTML head:

<base target="_top">

That way it reloads the entire page with the request, not just the iframe sandbox.

Upvotes: 1

Related Questions