CDN caching for desktop and mobile sites - php

I have a PHP based web application and want to be able to offer mobile users the option to view the content of my site through a dedicated set of 'mobile friendly' pages. The URL structure for the mobile site is different to the desktop site.
The idea is that the first time a mobile user hits the index page, a regexp checks the user agent and if they are a mobile device they are given the option to select to view either the desktop or mobile version of the site.
The problem is that I am caching static HTML with my CDN provider (Cotendo). This means that when the cache is populated the mobile user is likely to see a cached version of the desktop site and bypassing the mobile/desktop option page. It also means that with an empty cache, a mobile user could force the CDN to store the cached version of the mobile/desktop option page!
One option would be to check the user agent at the CDN level and bypass cache retrieval for mobile users. However, a signification proportion of traffic to the site is driven by mobile users and serving non-cached content to mobile users is not currently an option.

At the CDN level, can you add a ?mobileoption querystring for mobile devices. Then only show the mobile/desktop option page when that querystring is present.

Related

Link shares for a library portal

We are developing a library portal for our university. On this library website, we usually share many links to many content providers.
We have a requirement to implement so that users can perform actions through out users' experience of the library website including when using third-party content providers' platform.
For example: a user clicks on a content provider, from within the library website, continues browsing and when coming across an interesting article they should be able to share and/or save this article URL.
We have tried through utilizing an iframe whereby content providers covers the upper 90% of the page while the bottom 10% are used for call-for-action (save, share, etc).
This has failed due to obvious security reasons and all most all browsers does not support this if frame content resides outside our domain.
An alternative solution would be to implement a Chrome extension to achieve the same. However, forcing users to use a specific browser is not a healthy practice. Also we will face issues with mobile users.
I would appreciate listening to suggested workarounds.
You could use an alternative of an iframe. I think when a user clicks on a link to a 3rd party content provider:
Your site captures that click event
Send the requested url to your server via AJAX
Your server access the requested site contents
Your server dumps the requsted url HMTL/Javascript contents onto a modal of size 90% pn the user's screen
The remaining 10% of the screen can be utilized for a toolbar or any controls you may want like sharing, saving the link etc.

How to automatically Request Desktop Site For Wordpress Site

i have a wordpress site with a responsive theme. My only problem is that music players don't work on mobile devices because it needs the user to first check "Request desktop site" on the browser settings. If i do check request desktop site on the settings, the format is still the responsive one, but the players work (Music can finally be played).
Is there any way i could set up my wordpress site(plugins, or configurations) such that the desktop version is automatically requested?
I wouldn't want my visitors to do other stuff before exploring the site. They might even go away before trying out the "Request desktop site" option.
Here's the theme i use : http://themeforest.net/item/remix-musicbandclubpartyevent-wp-theme/full_screen_preview/8473753
And my plugin for the music player : https://wordpress.org/plugins/grand-media/

How to load Desktop version of webpage through mobile PHP page (user agent settings?)

I have a PHP page (which is displayed through a mobile/android browser) - however, when accessing a link to an external site - it automatically redirects to the mobile version.
I want the link to take user to the desktop version of the webpage even when accessed through a mobile browser.
Is there a way i can specify useragent/or any other setting in my PHP page code to acheive this? Thanks.
Spoofing the user agent string will be a challenge, as it requires you to control the behavior of the browser. You might be able to do it with JavaScript or something, but I doubt it.
If it's just one site, you may wish to take a look at how they're handling redirection of mobile devices. Often, sites will provide mechanisms for overriding the redirect script.
For example, sites using the UC Mobile Web Framework (http://mwf.ucla.edu/) allows you to override their redirect script with a query string parameter. The UCSF Library (http://library.ucsf.edu/) is using that framework for mobile redirects. If you are on a mobile device and go to http://library.ucsf.edu/ then you will be redirected to the mobile version of the site. However, if you go to http://library.ucsf.edu/?ovrrdr=1 then you will get the desktop version.
What you are describing, no. You do not have control of an external site therefore you cannot control what is being served.

How to develop a mobile version website, without changing it's domain name?

I want to develop the mobile (also includes iphone,ipad,andriod) version of my original site. But I don't want to create another sub domain like www.m.mydomain.com, can i dynamically change the document root separately for mobile version and the existing one?
I have also noticed that, when I open facebook form iphone or any andriod mobile it opens with it's original domain name like http://www.facebook.com/ bt when i open it from any other mobile like nokia or samsung it comes with http://m.facebook.com/, what is the difference between this 2?
When it comes to iPhone and Android deveices, a website needs very little adjustments because their web browsering capabilities are really good.
For other devices where the web browsing user experience is less satisfying, the site would dynamically switch them to an alternate and less "intense" version of the website.
As for the m.domain.com feature, this is just a subdomain of the domain.com website. Obviously, it represents a mobile version of the main site and will strip out things like flash and javascript basically anything which will be too much for a basic mobile browser.
The dynamic switching of browsers is done via code. There are ways of detecting what browser just requested your website. Based on the information returned you can then redirect to specific scripts which will handle the user requests from then on.
As an example, you can use this standard argument to check the browsers visiting your site:
$_SERVER['HTTP_USER_AGENT']
Hope that helped.
You can differentiate it by User-Agent property either on Apache level, or PHP level. Though that will not be guaranteed because UA can be spoofed. (But how many mobile users would do UA spoofing to pretend they're not mobile?)
you could possibly use some solution:
create a specific mobile website and put it on folder/subdomain and redirect any user with mobile to that site, example: mydomain.com/m/ or m.mydomain.com
example on redirection:
http://detectmobilebrowsers.mobi/
http://mobiforge.com/developing/story/lightweight-device-detection-php
or
you could use responsive webdesign technique, some framework already available for this
http://csswizardry.com/inuitcss/
http://www.columnal.com/
http://stuffandnonsense.co.uk/projects/320andup/
The difference is that high end mobile devices like iphone/android have enough support and functionality to support the original version of the website (zooming/javascript etc). Other devices are better served an basic website developed for mobile devices with a limited display and/or support.
You do want an special URL for your mobile website - as you'd like your mobile website to correctly appear in the mobile search of search engines.
www is actually also a subdomain, but it is so often used, people do not usually realize it, Usually most browsers add it by default and this is why most servers have it enabled by default.
The case you pointed out is also of subdomains. The server check your HTTP request's user-agent and redirects you to the mobile subdomain appropriately.
This isn't really a quick solution for you, but I highly recommend reading Ethan Marcotte's Responsive Web Design articles on alistapart.org. He goes over the philosophy as well as the practical steps to make a site work well for different contexts - desktop browser to mobile device, etc. There are several articles on the site (just search for responsive web design you'll get several of his articles in your results.)

Mobile website - how to switch to desktop version

I have a WordPress website (abetterworldbydesign.com) which has user-agent detection to redirect mobile websites to a subdirectory. It is using the plugin: WPtap Mobile Detector
I want to include a toggle link to switch between the mobile and desktop version. How can I make the site remember that a mobile user has switched to the desktop version and avoid redirecting that user to the mobile version again?
Checking the HTTP_REFERRER is the easiest method - no cookies & just one check.
If the referrer is on your domain - then don't redirect.
A session will probably be the easiest, or still detect mobile, but have a ?mobile=false attached the URL that prevents the user from being redirected, but allows them to easily get back to the mobile site.

Categories