Page 1 of 1

How to access data sent by navigator.sendBeacon

Posted: Wed Oct 14, 2015 9:05 am
by mahks
Documentation indicates sendBeacon sends its data via a HTTP POST request, but I cannot find the data sent.

Here is my javascript code : navigator.sendBeacon('log.php','Lost Data')

Browser logs indicate the "Lost Data" is the "request payload" for the request

In PHP the request is received but the $_POST variable seems to be an empty array.

I have sent from both Firefox & Chrome to both my local test server (windows) and to the live server (unix), all react the same.

What am I doing wrong?

Re: How to access data sent by navigator.sendBeacon

Posted: Thu Oct 15, 2015 10:19 pm
by mahks
Found the answer : The data from navigator.sendBeacon is in $HTTP_RAW_POST_DATA