From b5d99672f084f3e8c1ef72cdb38eb50679494ff5 Mon Sep 17 00:00:00 2001 From: Nic Jansma Date: Fri, 12 May 2017 18:40:34 -0400 Subject: [PATCH] sendBeacon: x-www-form-urlencoded --- boomerang.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/boomerang.js b/boomerang.js index a2bc25483..83df42b80 100644 --- a/boomerang.js +++ b/boomerang.js @@ -1836,9 +1836,15 @@ BOOMR_check_doc_domain(); // // Try the sendBeacon API first // - if (w && w.navigator && typeof w.navigator.sendBeacon === "function") { + if (w && w.navigator && + typeof w.navigator.sendBeacon === "function" && + typeof w.Blob === "function") { // note we're using sendBeacon with &sb=1 - if (w.navigator.sendBeacon(impl.beacon_url, paramsJoined + "&sb=1")) { + var blobData = new w.Blob([paramsJoined + "&sb=1"], { + type: "application/x-www-form-urlencoded" + }); + + if (w.navigator.sendBeacon(impl.beacon_url, blobData)) { return true; }