501 posts
  • Has referred 1000+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+8 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.
657 posts Fuel Your Web
  • Elite Author: Sold more than $75,000 on Envato Market
  • Won a competition
  • Had an item featured on Envato Market
  • Has been part of the Envato Community for over 7 years
+4 more
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.
657 posts Fuel Your Web
  • Elite Author: Sold more than $75,000 on Envato Market
  • Won a competition
  • Had an item featured on Envato Market
  • Has been part of the Envato Community for over 7 years
+4 more
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 ;)
501 posts
  • Has referred 1000+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+8 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.
657 posts Fuel Your Web
  • Elite Author: Sold more than $75,000 on Envato Market
  • Won a competition
  • Had an item featured on Envato Market
  • Has been part of the Envato Community for over 7 years
+4 more
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

501 posts
  • Has referred 1000+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+8 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.

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by