5

I have an html page with the following code.

  <form method="POST" action="https://formspree.io/email">
    <input type="submit" value="SEND"/>
  </form>

My browser does not include the referrer header field in the http request when a user submits the form. Why wouldn't it ?

AdrienM
  • 174
  • 2
  • 3
  • 10
  • First of all, please "Make sure you open this page through a web server, Formspree will not work in pages browsed as HTML files" as Formspree stats. Are you opening this HTML locally? – statosdotcom Apr 03 '16 at 00:38
  • I think you will find your way here: http://stackoverflow.com/a/266013/5885018 – statosdotcom Apr 03 '16 at 03:08

4 Answers4

12

I fixed this by adding <meta name="referrer" content="origin"> to the <head> section of my HTML page.

JeffJenk
  • 2,575
  • 2
  • 21
  • 28
7
  1. You are testing your site by opening it in a browser as a static HTML file in your computer's filesystem. In this case its URL will not start with http:// or https://. This will not work, because browsers don't treat these pages as normal web resources and thus they do not automatically send the "Referer" header when you submit a form. Formspree requires that header to work. This can be solved if you just open your HTML files as a web resource from a local web server. If you're on Mac or Linux, just type python -m SimpleHTTPServer 8000 or your HTML files directory and visit http://localhost:8000 on your browser. If you're on Windows, try installing one of the following super simple web servers: Web server for Chrome, thttpd or Quickshare.

  2. You are using an old Safari version, Safari mobile or some other browser that is not recent Chrome, Firefox or Edge. In this case you could have been a victim of an old HSTS policy we had on Formspree that didn't allow sites to post content to non-https versions of Formspree. In this case please change your form's action= attribute to https://formspree.io/.

Kas
  • 3,747
  • 5
  • 29
  • 56
1

First use the atributtes that formspree specify:

<form action="https://formspree.io/your@email.com"
      method="POST">
    <input type="text" name="name">
    <input type="email" name="_replyto">
    <input type="submit" value="Send">
</form>

and second: maybe you tried the form before in another site (like formspree site), so you'll have to reset it in the formspree site and then try it directly in your site, so you will have to confirm again.

Hope it works for you...

isk27
  • 329
  • 2
  • 5
  • 13
0

As statosdotcom commented, the issue happened because I was opening my webpage locally.

AdrienM
  • 174
  • 2
  • 3
  • 10