From 054c0311a9750a06288f436e6009e447b9e0f7ab Mon Sep 17 00:00:00 2001 From: Ben Scuron Date: Tue, 14 May 2024 19:40:24 -0400 Subject: [PATCH] Fix use of timeout property for synchronous XMLHttpRequests Convert XMLHttpRequests to be asynchronous to allow for the use of the timeout property. The timeout property can't be used for synchronous requests in a document environment (window/iframe) or an `InvalidAccessError` is thrown. --- src/Request.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Request.js b/src/Request.js index b926e12a5..c6a66da41 100644 --- a/src/Request.js +++ b/src/Request.js @@ -123,9 +123,9 @@ export function request (url, params, callback, context) { // ie10/11 require the request be opened before a timeout is applied if (requestLength <= 2000 && Support.cors) { - httpRequest.open('GET', url + '?' + paramString); + httpRequest.open('GET', url + '?' + paramString, true); } else if (requestLength > 2000 && Support.cors) { - httpRequest.open('POST', url); + httpRequest.open('POST', url, true); httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); }