No Gallery with Photonic Version > 2.60? Check Your CDN
-
If you have have upgraded to the latest version of Photonic, or any version ≥ 2.60 and you suddenly find your galleries missing, this may be happening due to a CDN issue.
CDNs are typically provided by your web hosting platforms and you might have enabled one for your site. If you have, then a change introduced in version 2.60 might be tripping up your CDN.
To verify, take a look at your JavaScript console in your browser (you can do so by keying F12, or Ctrl + Shift + I in Chrome). Do you see an error? Typically the error would look like this:
Access to script at 'https://my-host-cdn.com/path/to/photonic-lightbox.min.js?ver=xxxxxxxx-xxxxxx' from origin 'https://my-domain.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Your site’s domain is
https://my-domain.com/
, but your files are stored on a different server,https://my-host-cdn.com/
. In version 2.60 of Photonic there was a change to modernize the JavaScript. This is loaded with a special script attribute calledmodule
. When you have a JS file loaded as a module it is subjected to CORS (Cross-Origin-Resource-Sharing) restrictions. What this means is that your script has to be on the same domain as the page where it is being invoked, or it has to be served from a different domain using a suitable ‘Access-Control-Allow-Origin’ header.There are multiple things that can be done to resolve this, and I would recommend these two options in this order:
- Configure your site / host to avoid pulling the Photonic JS files from the CDN. If the file is pulled from your own site, this error goes away.
- If the above is not possible, then there is an option in Photonic itself – Photonic → Settings → Generic Options → Advanced → JavaScript Version. Pick the option that says “Include only transpiled code”. While this fixes the issue, you will not be able to take advantage of a modernized and smaller code base within Photonic.
If you are not using a CDN, then you are likely affected by a different problem. Please start a separate thread in such a case.
- The topic ‘No Gallery with Photonic Version > 2.60? Check Your CDN’ is closed to new replies.