1

Navigator.sendBeacon() does not follow Refresh header redirects, unlike regular 3xx server redirects. For example, in PHP:

header('Location: https://destination.url',true,3xx);

The above server code is followed without any issues by sendBeacon(). However, it fails to follow:

header('Refresh: 0; url=https://destination.url');

Is there anything the server can send along with the Refresh redirect header to get sendBeacon() to follow it correctly?

IMSoP
  • 89,526
  • 13
  • 117
  • 169
  • It's not actually clear what support _browsers_ have for that header, which never seems to have been standardised or even very well documented. What would you expect the beacon to do if it saw `Refresh: 300; url=https://destination.url` - should it wait for 5 minutes before following it? What about `Refresh: 5` - should it repeatedly ping the same URL every 5 seconds? If you have access to add extra information alongside the Refresh header, then why not send a proper standard Location header instead? – IMSoP Oct 18 '21 at 17:13
  • Meanwhile, I've edited the tags on your question, because the browser doesn't care if you're using PHP or a trained hamster to generate the response, what matters is the headers you send. – IMSoP Oct 18 '21 at 17:19

0 Answers0