Multilingual - No 'Access-Control-Allow-Origin' for JS files on language change

General questions regarding the use of languages in Joomla! 4.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
Zestminds_1
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu Nov 02, 2023 4:59 am

Multilingual - No 'Access-Control-Allow-Origin' for JS files on language change

Post by Zestminds_1 » Fri Nov 03, 2023 7:16 am

Hi,
Site is working fine before i upgraded the website to the latest version of Joomla.

Now On language change it is not showing the Tabs on Product page . Only working with English language which is default language.
Description
Compliance Certificates
Related Products

Page Url French :

https://fr.staging.dintek.com.tw/index. ... cable-gray

Img attached : fr.PNG

Englsih :https://staging.dintek.com.tw/index.php ... cable-gray
Img attached : en.PNG

I am also getting errors in console on language change. Img attached=> console.PNG

Access to script at 'https://staging.dintek.com.tw/media/ven ... n.js?5.3.2' from origin 'https://fr.staging.dintek.com.tw' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Please guide me to solve this

Thanks
You do not have the required permissions to view the files attached to this post.
Last edited by toivo on Fri Nov 03, 2023 8:25 am, edited 1 time in total.
Reason: mod note: typo in subject

User avatar
pe7er
Joomla! Master
Joomla! Master
Posts: 25010
Joined: Thu Aug 18, 2005 8:55 pm
Location: Nijmegen, Netherlands
Contact:

Re: Mutilingual - No 'Access-Control-Allow-Origin' for JS files on language change

Post by pe7er » Fri Nov 03, 2023 7:36 am

Welcome to Joomla forum!

Are you using Google Chrome?
Chrome version 118 has an issue with the "Cross-Origin-Opener-Policy" (CORS) setting in your website.

Joomla uses the "System - HTTP Headers" plugin for extra safety.
For testing you can switch it off temporary: System > Plugins > search the "System - HTTP Headers".
The first tab "Cross-Origin-Opener-Policy" is default "same-origin".
When you set it to "Disabled" the error issue will go away.
However, that is not recommended.
When you update to Chrome 119 the error will be gone.

See this related topic:
viewtopic.php?f=817&t=1004745
Kind Regards,
Peter Martin, Global Moderator
Company website: https://db8.nl/en/ - Joomla specialist, Nijmegen, Netherlands
The best website: https://the-best-website.com

Zestminds_1
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu Nov 02, 2023 4:59 am

Re: Multilingual - No 'Access-Control-Allow-Origin' for JS files on language change

Post by Zestminds_1 » Fri Nov 03, 2023 8:51 am

Hi

Plugin "System - HTTP Headers" is already disabled on the wesbite.
And I am getting 'Access-Control-Allow-Origin' in every browser and My client also getting same error in console.

Thanks

User avatar
pe7er
Joomla! Master
Joomla! Master
Posts: 25010
Joined: Thu Aug 18, 2005 8:55 pm
Location: Nijmegen, Netherlands
Contact:

Re: Multilingual - No 'Access-Control-Allow-Origin' for JS files on language change

Post by pe7er » Fri Nov 03, 2023 10:15 am

Does your server send those "Cross-Origin-Opener-Policy" headers itself?
Joomla's "System - HTTP Headers" plugin can configure HTTP Security Headers, you can also configure it as server level.

You can check your HTTP Security Headers at https://securityheaders.com/
Kind Regards,
Peter Martin, Global Moderator
Company website: https://db8.nl/en/ - Joomla specialist, Nijmegen, Netherlands
The best website: https://the-best-website.com

User avatar
ceford
Joomla! Hero
Joomla! Hero
Posts: 2737
Joined: Mon Feb 24, 2014 10:38 pm
Location: Edinburgh, Scotland
Contact:

Re: Multilingual - No 'Access-Control-Allow-Origin' for JS files on language change

Post by ceford » Fri Nov 03, 2023 6:10 pm

Standard Joomla 4 Multilingual sites have the currently selected language following the domain and not preceding the domain. And assets mostly do not include the domain, so this:

Code: Select all

<script src="/media/system/js/core.min.js?576eb51da909dcf692c98643faa6fc89629ead18" data-asset-name="core"></script>
Rather than

Code: Select all

<script src="https://staging.dintek.com.tw/media/system/js/core.min.js?9c761ae035a6bd778a710e6c0f5ff7de049b67a3"></script>
That could be the problem. Not sure and don't know how you would fix it. The problem affects your js modules and fonts (woff).

User avatar
pe7er
Joomla! Master
Joomla! Master
Posts: 25010
Joined: Thu Aug 18, 2005 8:55 pm
Location: Nijmegen, Netherlands
Contact:

Re: Multilingual - No 'Access-Control-Allow-Origin' for JS files on language change

Post by pe7er » Fri Nov 03, 2023 6:26 pm

ceford wrote:
Fri Nov 03, 2023 6:10 pm
Standard Joomla 4 Multilingual sites have the currently selected language following the domain and not preceding the domain. And assets mostly do not include the domain, so this:

Code: Select all

<script src="/media/system/js/core.min.js?576eb51da909dcf692c98643faa6fc89629ead18" data-asset-name="core"></script>
I think that ceford is right. I had not spotted that. Good catch! Thanks ceford!
Kind Regards,
Peter Martin, Global Moderator
Company website: https://db8.nl/en/ - Joomla specialist, Nijmegen, Netherlands
The best website: https://the-best-website.com


Post Reply

Return to “Language - Joomla! 4.x”