Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter redraptor10

    (@redraptor10)

    Update: I decided to rewrite my code and use JavaScript and sessionStorage to read in user data, dynamically changing the contents on my site. So far, this seems to have worked. My site is successfully being cached and visitors can dynamically change its content with their settings being saved to sessionStorage. This has helped as my site is using less resources now that the caching works. Hopefully this helps anyone else who faces this issue.

    As for disabling the SiteGround cache completely, from my research I don’t think it is at all possible. The SG Optimizer devs seem to always respond by saying to disable all other caching plugins. A bit unfortunate since other plugins such as W3 Total Cache seem to have a lot more customizable options.

    Thread Starter redraptor10

    (@redraptor10)

    Hi. I’ve been thinking about this some more, I believe the answer is that it is actually not possible to use cookies with Dynamic Cache. However I would still like to read user data in some way.

    1. Would it be possible to use JavaScript and localStorage to get the desired effect? (ie. Read localStorage variable, then dynamically change the page’s contents based on that variable)

    2. The other possible option would be to disable SiteGround cache completely, and use another caching plugin. Is it possible to disable SiteGround cache? Even when I uninstall SG Optimizer, SiteGround still seems to cache my site.

    I realize this doesn’t really relate to SG Optimizer, but if you can point me in the right direction it would help a lot! My site has been going down the past few months, so I would like to get caching to work while still maintaining my “dynamic button images” feature. Thanks.

    Thread Starter redraptor10

    (@redraptor10)

    Yes that was it!! For my case, it was a combination of the “Anti-Spam by CleanTalk” plugin and my site using custom cookies. I disabled both and Dynamic Caching now working. Thank you so much.

    If you don’t mind answering one more question, this does cause another problem on my site. My custom cookies are necessary because it allows users to set their own “gaming platform” (ie. PlayStation 4 or Xbox One). Is it possible for me to still use this cookie while also maintaining the Dynamic Caching?

    My cookie is set with the following code (I commented out for now to enable Dynamic Caching):

    /*$platform = 'Universal'; // Default Platform
    if (isset($_COOKIE['savedPlatform'])) { $platform = $_COOKIE['savedPlatform']; } // Set Platform to Cookie
    // Check if POST is set, then set Platform to POST
    if (isset($_POST['platform'])) { $platform = $_POST['platform']; }
    setcookie("savedPlatform", $platform, time()+60*60*24*30, "/"); // Set Cookie to Platform*/

    Ideally, I want users to select their desired platform, which will set a cookie. Then if possible flush the cache, so everytime users visit my site they will see the new platform’s images (which is read from the cookie). Would this be possible? Thanks in advance!

    • This reply was modified 3 years, 8 months ago by redraptor10.
    Thread Starter redraptor10

    (@redraptor10)

    I apologize, I completely forgot that I had already made this topic a week ago!

    I disabled all other plugins besides SG Optimizer, but it was still giving me the URL is not cached message. I’m not quite knowledgeable about set-cookie headers, what steps would I need to take to find out where that problem might be? Thanks in advance, and again sorry for making this topic again.

    Thread Starter redraptor10

    (@redraptor10)

    Yes it seems that way. I originally wanted to use W3TC because W3TC seems to give a lot more options, and SiteGround was saying my site wasn’t being cached, but now I know it is actually working. I don’t see an option to completely disable SiteGround cache, so I guess I will have to disable W3TC and use SiteGround.

    I will mark this as resolved. Thank you again for helping me resolve this issue!

    Thread Starter redraptor10

    (@redraptor10)

    Hi. Sorry to message again, please ignore my previous post.

    I believe my website host (SiteGround) was causing conflict with W3TC. In SiteGround settings, I disabled “Dynamic Cache”.

    Now in W3TC, the problem only occurs when I enable “Page Cache”. If I disable “Page Cache”, everything works fine. So now the issue seems to be “Page Cache”.

    After enabling Page Cache, I try clicking “Purge Caches” and “Empty Caches”, but it is still showing the cached page. I can only manually refresh the cache by going into SiteGround settings and clicking “Flush Cache”. Is it possible that SiteGround is blocking W3TC?

    • This reply was modified 3 years, 8 months ago by redraptor10.
    • This reply was modified 3 years, 8 months ago by redraptor10.
    Thread Starter redraptor10

    (@redraptor10)

    Hi.

    First thing I did this morning I disabled all settings then tried viewing page and it was working fine (probably because page has not been cached yet). I decided to narrow down the problem and enable each setting one by one. The problem started again when I enabled “Page Cache”.

    After this, I disabled all settings again but the issue still persists. It still shows the cached page even after I “Purge Caches”, disabled all settings and clear Chrome cache settings. This is very strange.

    Video:
    https://www.youtube.com/watch?v=71-znoNVXlw

    EDIT:
    Hi. After this post, I disabled W3 Total Cache and tried again. It was still showing the cached page… does this mean the problem is somewhere else? For some reason, the issue starts when I enable W3 Total Cache and it caches the pages, but after disabling it the problem persists.

    • This reply was modified 3 years, 8 months ago by redraptor10.
    Thread Starter redraptor10

    (@redraptor10)

    Hi.

    I have tried disabling Browser Cache and “set expires header” and “set cache-control header” but the problem still persists. Video:

    https://www.youtube.com/watch?v=htoUvpoDKF0

    I have left them disabled for now if you’d like to try yourself.

    I have also tried disabling both Page Cache and Browser Cache but the issue still persists. It only works if W3TC is completely disabled.

    Thread Starter redraptor10

    (@redraptor10)

    Hi.

    I’ve disabled W3TC and it works as intended. Attached video showing expected behavior:
    https://www.youtube.com/watch?v=5kmAhEI37l4

    I am not sure why it works on Firefox for me but not Chrome. Perhaps there is a setting that is causing this, or perhaps it has something to do with my code. Just for reference, I am setting the platform cookie like this:

    $platform = 'Universal'; // Default Platform
    if (isset($_COOKIE['savedPlatform'])) { $platform = $_COOKIE['savedPlatform']; } // Set Platform to Cookie
    // Check if POST is set, then set Platform to POST
    if (isset($_POST['platform'])) { $platform = $_POST['platform']; }
    setcookie("savedPlatform", $platform, time()+60*60*24*30, "/"); // Set Cookie to Platform

    The above code works when I disable W3TC, and I believe it should work when enabled as well, but revisiting a page still shows the cached page/platform for some reason. I have re-enabled W3TC after this post in case you are still trying to solve this.

    It is completely fine if you are unable to find a solution for this. I appreciate the quick response and that you took the time to try and help with my problem. I guess I will keep on looking for a solution for this

    • This reply was modified 3 years, 8 months ago by redraptor10.
    Thread Starter redraptor10

    (@redraptor10)

    Hi, thank you for the quick response!

    Yes that is what happens on my end as well. However, when revisiting the page it will go back to the original platform. (ie. Click blog post->select platform->Home->click blog post again). This doesn’t seem to happen on Firefox or when I disable W3 Total Cache.

    I have attached video to show how it looks like:
    https://www.youtube.com/watch?v=GcFs_Iw7x5E

Viewing 10 replies - 1 through 10 (of 10 total)