How to access data sent by navigator.sendBeacon

For discussions about game development that does not fit in any of the other topics.
Post Reply
User avatar
mahks
Posts: 50
Joined: Fri Nov 22, 2013 11:07 am

How to access data sent by navigator.sendBeacon

Post 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?
Image
Diplomacy, Trade & Conquest in the 4th Millenium

http://www.starlords3k.com
User avatar
mahks
Posts: 50
Joined: Fri Nov 22, 2013 11:07 am

Re: How to access data sent by navigator.sendBeacon

Post by mahks »

Found the answer : The data from navigator.sendBeacon is in $HTTP_RAW_POST_DATA
Image
Diplomacy, Trade & Conquest in the 4th Millenium

http://www.starlords3k.com
Post Reply

Return to “General Development”