Need some help with my script

I have this HTTP request, I expected this, but WURFL is returning that. Please provide enough data to reproduce the problem.
HenkvD
Posts: 7
Joined: Sat Nov 19, 2011 1:43 pm

Need some help with my script

Postby HenkvD » Tue Mar 19, 2013 3:00 pm

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)?

sm_support2
Posts: 294
Joined: Mon Jun 20, 2011 5:04 pm

Re: Need some help with my script

Postby sm_support2 » Tue Mar 19, 2013 5:27 pm

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)

kamermans
Posts: 393
Joined: Mon Jun 06, 2011 9:50 am

Re: Need some help with my script

Postby kamermans » Tue Mar 19, 2013 8:57 pm

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!

HenkvD
Posts: 7
Joined: Sat Nov 19, 2011 1:43 pm

Re: Need some help with my script

Postby HenkvD » Wed Mar 20, 2013 12:44 pm

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)

kamermans
Posts: 393
Joined: Mon Jun 06, 2011 9:50 am

Re: Need some help with my script

Postby kamermans » Thu Mar 21, 2013 3:42 pm

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".
Thanks,

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