For the website of my single-man-company I use Wurfl to redirect mobile users to a mobile version of my website.
This is the script I put in the pages to redirect:
require_once("wurfl/TeraWurfl.php");
$wurflObj = new TeraWurfl();
$wurflObj->getDeviceCapabilitiesFromAgent();
$isWireless = $wurflObj->getDeviceCapability("is_wireless_device");
if($isWireless)
header("location: http://www.m.klussenpunt.nl/index.html");
As an amateur programmer I'm happy the way this works for several years and that I figured this out.
My main website is 1000 pixels width and the mobile website is 300 pixels width.
At this moment all the tablets wil be redirected to the mobile website, and that is unnecessary, a bit annoying even.
The question: could anyone help me provide some script I can use redirecting only the devices with a width smaller than 800 pixels (landscape)?
Need some help with my script
-
- Posts: 294
- Joined: Mon Jun 20, 2011 5:04 pm
Re: Need some help with my script
is_tablet and ux_full_desktop are also your friends.
Pretty much all tablets have double orientation, so telling actual width out of HTTP inspection is impossible.
Responsive Web Design, with Server-Side optimization may be an option you want to explore for Desktop+Tablet:
http://www.scientiamobile.com/blog/post ... sign-(RWD)
Pretty much all tablets have double orientation, so telling actual width out of HTTP inspection is impossible.
Responsive Web Design, with Server-Side optimization may be an option you want to explore for Desktop+Tablet:
http://www.scientiamobile.com/blog/post ... sign-(RWD)
Re: Need some help with my script
Here's an updated code snippet:
Code: Select all
require_once("wurfl/TeraWurfl.php");
$wurflObj = new TeraWurfl();
$wurflObj->getDeviceCapabilitiesFromAgent();
$isWireless = $wurflObj->getDeviceCapability("is_wireless_device");
$isTablet = $wurflObj->getDeviceCapability("is_tablet");
if($isWireless && !$isTablet)
header("location: http://www.m.klussenpunt.nl/index.html");
Thanks,
Steve Kamerman
ScientiaMobile
Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!
Steve Kamerman
ScientiaMobile
Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!
Re: Need some help with my script
Thanks for the reply,
Server side optimization sounds great but is out of my league for this moment due to the fact that I have not enough time to spend.
The code snippet uses wireless and tablet as condition to redirect to my mobile website.
I think most of the tablets can view my main website perfectly well, so I would like to redirect if the device is wireless and not a tablet.
How can I put this in the code?
Thanks in advance.
Henk (Netherlands)
Server side optimization sounds great but is out of my league for this moment due to the fact that I have not enough time to spend.
The code snippet uses wireless and tablet as condition to redirect to my mobile website.
I think most of the tablets can view my main website perfectly well, so I would like to redirect if the device is wireless and not a tablet.
How can I put this in the code?
Thanks in advance.
Henk (Netherlands)
Re: Need some help with my script
Hi Henk,
The code I posted previously does just that. Note that their is a "!" before $isTablet which means "if is wireless and not is tablet".
The code I posted previously does just that. Note that their is a "!" before $isTablet which means "if is wireless and not is tablet".
Thanks,
Steve Kamerman
ScientiaMobile
Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!
Steve Kamerman
ScientiaMobile
Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!
Who is online
Users browsing this forum: Bing [Bot] and 12 guests