491 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Won a Competition
  • Referred between 1000 and 1999 users
  • Author had a Free File of the Month
  • Author had a File in an Envato Bundle
  • Bought between 10 and 49 items
+3 more
pixelentity says

To avoid that caching issue why don’t we use a PHP session for that? Each time a retina device opens the page a session is created setting a PHP variable to true. This should fix that, right?
No, it won’t unless you disable page caching for mobile devices.
555 posts Fuel Your Web
  • Elite Author
  • Won a Competition
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Has been a member for 7-8 years
  • Bought between 50 and 99 items
  • Referred between 200 and 499 users
  • Europe
Pirenko says


To avoid that caching issue why don’t we use a PHP session for that? Each time a retina device opens the page a session is created setting a PHP variable to true. This should fix that, right? I’m currently coding a solution with sessions that seems to be working…
you can’t detect retina via php
I know, but it would be so easy if we could :)
My idea at this moment is:
1) Page loads and with javascript we check if it’s a retina display.
2.a) No retina display and the pages loads normally;
2.b) Argh! It’s a retina display! We create a PHP session and store a PHP variable saying that. The next time the page loads we have this variable on the header and we can add classes to images or resize them accordingly.
555 posts Fuel Your Web
  • Elite Author
  • Won a Competition
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Has been a member for 7-8 years
  • Bought between 50 and 99 items
  • Referred between 200 and 499 users
  • Europe
Pirenko says


To avoid that caching issue why don’t we use a PHP session for that? Each time a retina device opens the page a session is created setting a PHP variable to true. This should fix that, right?
No, it won’t unless you disable page caching for mobile devices.
As far as I know sessions are created each time you open a website after a long period or after having closed and opened the browser application. So there’s no caching thing here. At least it seems to be like this to me ;)
491 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Won a Competition
  • Referred between 1000 and 1999 users
  • Author had a Free File of the Month
  • Author had a File in an Envato Bundle
  • Bought between 10 and 49 items
+3 more
pixelentity says

As far as I know sessions are created each time you open a website after a long period or after having closed and opened the browser application. So there’s no caching thing here. At least it seems to be like this to me ;)
Page caching plugins create a static html version of the page which is served by the webserver directly using .htaccess rules, no php is involved in the process.
555 posts Fuel Your Web
  • Elite Author
  • Won a Competition
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Has been a member for 7-8 years
  • Bought between 50 and 99 items
  • Referred between 200 and 499 users
  • Europe
Pirenko says

So you are saying that I can’t create PHP sessions when a caching plugin is enabled? This does not make sense to me :S

491 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Won a Competition
  • Referred between 1000 and 1999 users
  • Author had a Free File of the Month
  • Author had a File in an Envato Bundle
  • Bought between 10 and 49 items
+3 more
pixelentity says

So you are saying that I can’t create PHP sessions when a caching plugin is enabled? This does not make sense to me :S
To serve static html (where possible) is several times faster than using php generated content, around 100x if you consider the average wp page. Server side device dependent markup would make full page caching almost impossible, much harder at the very least and to serve images via php would be even worst. A client side (js) solution would be cache friendly and should be preferred.
by
by
by
by
by
by