Search code examples
htmlformspostlocal

Form POST from local file to website?


Pretty sure the answer is no, but I've not been able to articulate the question in a way that's let me find a definitive answer via search.

Can I make a local html file that submits a form to a website, and have that data accepted?

At work I basically copy info, from an xml source that arrives email by email, into multiple tools. This feels a bit like a job for a robot. I'd like to make a webpage that accepts the xml file and automatically sorts the data into form fields that I can submit via POST directly to the web tools.

  • Can't be done without a webserver right?
  • And even then, cross domain posting is usually disallowed?

I don't have access to the databases or apis unfortunately. And we use IE9, so I don't think there's an approach like greasemonkey or a homemade extension that I could leverage to move the data directly into the webform on page.

Thanks for confirming if this is possible or not.


Solution

  • Cross-domain posting is the source of Cross-Site Request Forgery vulnerabilities. Since JavaScript can submit forms, and your login is based on your browser, a site you visit can autopopulate a form and submit it in the background of a site you visit and it will be submitted on your behalf.

    So it will work if there aren't protections in place to prevent that (generally a security token stored in the session and submitted as part of the form).