This is normal because browsers don't allow scripts to work across different domains such as http://mysite.com and http://www.mysite.com or http://www.mysite.com and https://www.mysite.com, indeed for security policy scripts are blocked and limited to work on the same domain.
If you experience such an issue on your website it could be related to an old and deprecated setting of the Joomla! configuration.php file.
By default Joomla! uses a dynamic base address for the website, having a look at the Joomla! configuration.php file you can double check if the variable named '$live_site' has an empty value as it should be in a standard Joomla! installation. Hardcoding a domain in the '$live_site' variable was required at the time of Joomla! 1.0 only, so nowadays it's strongly recommended to always leave this field empty.
By the way keep in mind that as a good SEO practice your website should always be configured to use only 1 domain, so it's recommended that you redirect from one domain to another using the htaccess: https://joomlaseo.com/checklist/choose-www-or-non-www