Navigator.sendBeacon() to pass header information

后端 未结 6 1923
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:17

    Posting as an answer as I'm not allowed to post a comment under the answer:

    For Chrome, issue with navigator.sendBeacon sending Blob for with non CORS-safelisted types was fixed in Chrome version 81 so this should be safe to use now. https://bugs.chromium.org/p/chromium/issues/detail?id=724929

    For IE, an alternative in unload event is to use synchronous ajax request, as IE doesn't support sendBeacon but supports synchronous ajax call in my case.

提交回复
热议问题