eZ Community » Forums » Developer » eZ Publish and mobile detection...
expandshrink

eZ Publish and mobile detection without redirecting

eZ Publish and mobile detection without redirecting

Thursday 12 April 2012 10:26:33 am - 6 replies

Hi. Yeah, another topic about ezpublish and mobile redirection happy.gif Emoticon. I've seen some pages built with ez, we also have some of them, but all that i've seem rely on redirection to present mobile content. 

I've recently taken a course about this things, and one of the things explained there is that the optimal thing is to not redirect if possible and adapt the content to all devices. This is really well explained in this post by the Netgen crew, where we're pointed to that wonderful A List Apart article. 

For now, we can use mediaqueries and play with css in a only ez publish siteaccess to try to go in that "responsive design way". but still there's something that needs to be optimized and that depends of server. 

For instance, is not a good idea resizing images via css. i mean, if you have a 600x400 image for your desktop version news, is not a good idea that css takes control of the resizing of these images. more bytes to download, more money to the user if not in a wifi... more battery wasted... and so on. 

and that's the thing that still cannot be done with ezpublish (afaik) because of the view cache. i mean, we can have an operator in our templates for, for instance, sending a small image to the mobile devices and a bigger one to the desktop devices...

{if $ismobile}
    <img src={$node.data_map.image.content.mobile_alias.url|ezroot} width... height... />
{else}
    <img src={$node.data_map.iamge.content.desktop_alias.url|ezroot}.... />
{/if} 

But having this in a view full template, it will be cached, and if the cached "was made" by a mobile device, desktop users will see the mobile image instead of the big one...

So... the only idea i have is that viewcache should also take browsers or a list a group of browsers in account for getting this behaviour...

Any ideas? Am i saying something crazy? happy.gif Emoticon

Thursday 12 April 2012 10:44:49 am

hello Carlos,

i suggest you do redirect on vhost on regards to the user agent... then there is no redirect for user in the website ...

what do you think about it ?

alex

Thursday 12 April 2012 10:46:59 am

that's another option, but with redirect... i would like to be able to avoid redirect at all, even in the vhost happy.gif Emoticon

Cheers.

Thursday 12 April 2012 10:49:38 am

Btw, i think this will be doable with the new template engine... the problem, as has been stated in some other discussions, is that it will be really really cool to have some {do-not-cache-this}{/do-not-cache-this}  insite the view cache. I tried to work on that but declined after some good advices from the eZ Systems crew happy.gif Emoticon

Thursday 12 April 2012 10:58:34 am

One thing that could work is working in a new ViewCacheTweaks option... something like

ViewCacheTweaks[2]=per_browser...

but this would be hardly maintainable if you want to add it to all your "news" object, for example... It would be nice a ViewCacheTweaksPerClass thing happy.gif Emoticon

Thursday 12 April 2012 12:55:05 pm

The reply has been removed because of violation of forum rules.

Thursday 12 April 2012 9:50:38 pm

Ha! I was discussing this the first time I checked bootstrap.

If you check techcrunch, yahoo, and bbc with one android device, all of them redirects the user to the mobile version, I know you don't like it, but this is the standard solution, and with the new 4.7 layout, that is using bootstrap, it will be just a matter of duplicating the main siteaccess and overriding image.ini.append.php.

Why other solutions are bad:

  • Resizing: as you said, loads more content then the necessary.
  • New template Engine: adds complexity to the template engine AND doesn't cache parts of the code.
  • Ajax, like lazy load: you would need to process a lot of image requisitions, unless all images alias were created as soon as the content is published, then you would just need to use lazy load and change all image source addresses to the mobile size.This is like including a css rule to the site if screen width is too small, hiding all images by default, then call one ajax function that modifies the src for all images, then call one javascript function to show all images.

Personally I prefer just follow the current standard, just add one redirection rule and one robots.txt rule to avoid mobile version indexing, done.

Modified on Thursday 12 April 2012 10:04:47 pm by Thiago Campos Viana

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from