I recently encountered this XMLHttpRequest error myself. The root of the problem caused 3 different issues.
SOLUTION: In my case, the problem was caused by an incorrect setting for the public $live_site variable in the configuration.php file (which is located in the Joomla root folder). The website was https://website.com but I had set the
public $live_site = 'https://www.website.com'; <-
The www
should not have been there.
In the end I set public $live_site = '';
but public $live_site = 'https://website.com';
would have worked as well.
Alternatively, you could probably set cors to enable cross-origin resource sharing, but this is a server side solution which in my case was unnecessary. Also if you set it incorrectly it can be a security risk.
Incorrectly setting $live_site in configuration.php caused 3 problems.
When logging into https://website/administrator I was not notified of new extension updates. When I logged into website.com/administrator with the console open (Ctrl + Shift + i) I could see the error -
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.website.com/administrator/index.php?option=com_installer&view=update&task=update.ajax&cbe7c724489164bc62ef5fd63d87884b=1&eid=0&skip=700. (Reason: CORS header 'Access-Control-Allow-Origin' missing)
.The 2nd problem occured when I tried to reinstall Joomla by going to Administrator -> Components -> Joomla!Update -> Live Update. For installation method I chose to Overwrite files. I got a message saying
"Error: AJAX loading Error:error" and then in the console I could see
with the following message
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.website.com/administrator/components/com_joomlaupdate/restore.php. (Reason: CORS header 'Access-Control-Allow-Origin' missing).
The third problem I wasn't aware of until I this question. When uploading images either in the media manager, in an article or in a module, the site acts like it's uploading the image, refreshes, but never actually uploads the image.
All these problems were caused by an incorrect value for the $live_site variable in configuration.php What a PITA!!!.
I eventually stumbled onto the answer thanks to a reference found in http://www.itoctopus.com/bloghttps://www.itoctopus.com/ajax-loading-error-error-when-updating-your-joomla-website