Navigator.sendBeacon() to pass header information

后端 未结 6 1924
Happy的楠姐
Happy的楠姐 2020-12-06 00:51

I am using navigator for communicating with the server , but problem is that we need to pass some header information as there is filter which recognise the request is from t

6条回答
  •  忘掉有多难
    2020-12-06 01:21

    After searching for an answer for this question I found out that for passing header with navigator we need to pass a blob object.

    For example

    var headers = {type: 'application/json'};
    var blob = new Blob(request, headers);
    navigator.sendBeacon('url/to/send', blob);
    

提交回复
热议问题