Support » Plugin: Social Chat » Problem with cache plugin and check for mobile device

  • Resolved netconsulting


    Hi there,

    Great plugin. We only have a small problem.

    On line 396 and line 512 (AMP) you check if the web is viewed on a mobile device (via PHP code):
    if (wp_is_mobile() ) {echo "api";} else {echo "web";}
    and choose the protocol accorging to the device.

    We are facing problems with cache plugins as they cache this check and normally the cached URL is always the URL so that on a mobile device the link is not opened in the Whatsapp APP but in the browser (asking for web login).

    Any idea how to solve this? In order to avoid cache plugin issues this check should be done in Javascript but we really don’t know how exactly.

    Thanks for your time.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @netconsulting
    This is a very commom issue and you don’t need any javascript to solve that.
    Usally cache plugins have a option to enable a diferent cache for mobile. I’ll give you a example how it appears in litespeed cache (follow the screenshoot bellow).

    I’m prety sure wp-rocket and w3tc also has that option.
    I̶f̶ ̶y̶o̶u̶ ̶d̶o̶n̶’̶t̶ ̶h̶a̶v̶e̶ ̶t̶h̶a̶t̶ ̶o̶p̶t̶i̶o̶n̶ ̶y̶o̶u̶ ̶s̶h̶o̶u̶l̶d̶ ̶c̶o̶n̶s̶i̶d̶e̶r̶ ̶c̶h̶a̶n̶g̶e̶ ̶y̶o̶u̶r̶ ̶p̶l̶u̶g̶i̶n̶ =)

    Second option would be disable your mobile cache (I do not recommend that option if you are not using amp).
    You can disable only for specific agents like Android…

    Make sure you clear all cache (specially object cache) and your browser cache to run another test.

    That’s it!
    Hope it helps…

    Thread Starter netconsulting


    Thanks!!!! We just activated the mobile cache at WP ROCKET. We didn’t think of this solution.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem with cache plugin and check for mobile device’ is closed to new replies.