• Resolved skylinks

    (@skylinks)


    Hi,

    I’m running an eCommerce store & using Fancy Product Designer for most of my products, but the issue is if I enable Optimole then face CORS error most of the time only on single product pages where FPD is active.

    Is there a way to optimize images only on the home page or certain pages? I mean any snippet so I can allow optimization using Page IDs?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Vytis

    (@bvytis)

    Hi @skylinks,

    Thank you for using Optimole and contacting us.

    Could you share the page URL where you face the CORS issue? It should be possible to whitelist the resource on your end and prevent the CORS issue.

    The images might be blocked when used inside the canvas element of the plugin that you are using to customize the product since the images are being served from a different domain than the one where the canvas is being displayed. This is the default behavior of the canvas element in HTML. You can try to add this to your .htaccess

    <IfModule mod_setenvif.c>
      <IfModule mod_headers.c>
        <FilesMatch "\.(bmp|cur|gif|ico|jpe?g|png|svgz?|webp)$">
          SetEnvIf Origin ":" IS_CORS
          Header set Access-Control-Allow-Origin "*" env=IS_CORS
        </FilesMatch>
      </IfModule>
    </IfModule>

    In short, this configures the server to allow graphic files (those with the extensions “.bmp”, “.cur”, “.gif”, “.ico”, “.jpg”, “.jpeg”, “.png”, “.svg”, “.svgz”, and “.webp”) to be accessed cross-origin from anywhere on the internet.

    I hope it helps!

    Thread Starter skylinks

    (@skylinks)

    Hi,

    Thank you for the detailed explanation & solution, but the issue is the website is hosted on wordpress.com & I’m unable to find .htaccess using FTP client. Is there another way to fix this problem?

    Plugin Support Vytis

    (@bvytis)

    Hi @skylinks,

    I’m not aware of an alternative solution, unfortunately, so I would recommend checking with the support team of wordpress.com so they can help you to find the .htaccess file and edit it or offer an alternative method to add it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Is it possible to optimize images only on certain pages?’ is closed to new replies.