Submit Form Example Script?

Can someone provide me with an example script that submits login info to input fields and then submits it? I tried it with shortcuts and it didn’t work and I don’t know why. As an example, how would I login on When I look at the html I see the input field names and the submit button but I don’t know how to work with them.

Also, is it possible to request a site with cookies so that I don’t need to submit a form?

I suggest using the Reddit API instead.

I used Reddit as an example. I generally want to know how to do it.

You’re going to struggle with that one. Something like 1Password or another password manager that has updated for iOS 12 will be your best bet to fill in the credentials. Unsurprisingly iOS doesn’t support much in this direction for security - so you’ll still have to tap login yourself.


Thanks, I actually did it now. My mistake was that I didn’t pass on the right referer. The site denied access since the request didn’t come from the signin page but from the main page.
Now I need to figure out how to wait until the site redirects me and then get the body of that site.
Would that be something like await loadString() ?

For the use with cookie you can try:

let r = new Request('http://your-domain.tld');
r.headers = {'Set-Cookie': 'a=12'};
r.method = 'POST';

If you what to send like a form will do, look at:
addParameterToMultipart(name, value)

and send also with ‚POST‘

Any chance of sharing this script? I have wanted to do something along these lines forever

You could try

let r = new Request('');
r.method = 'POST';
r.addParameterToMultipart("login", "john doe");
r.addParameterToMultipart("password", "topsecret");
let payload = r.load();

But this would not work on most sites! Because? Most Sites implements an hidden authentication token in a hidden field which was generated when the login page was loaded in the browser. You have to parse for that token in a first step, extract it and use it within your request.



Thank you! I will give it a try. This javascript stuff is all new to me!

Good resource for learning JavaScript:



Thank you. I will take a look!

I kind of have the same need, but in my case I want to upload audio files to my Overcast uploads with a tap of a shortcut widget (or through the share sheet). Hence I want to be able to first authenticate with my overcast account and then post a file.