AccountStackOverflow
AccountStackOverflow

Reputation: 55

Redirecting from Desktop to Mobile site

I'm running a very simple, brochure website on Wordpress and my client needs a mobile website.

I want to redirect mobile visitors from the desktop website to the mobile website. I do not have the technical knowlegde to re-design and re-develop my CMS, so I am planning on making a new subdirectory with mobile-optimized HTML pages and working from there.

Any thoughts on how to make a device-sensitive redirect?

Upvotes: 0

Views: 449

Answers (4)

vlscanner
vlscanner

Reputation: 458

I am using mobileesp for php site and it works just right, it appears there is also now javascript available to do the same. Apparently the site has samples. Hope this helps:

http://blog.mobileesp.com/?cat=8

Upvotes: 1

Luke Wyatt
Luke Wyatt

Reputation: 1136

I use this PHP statement to check for mobile browsers. I doubt I have all browsers in this function, but it is a start. You seem to have the know-how to make the basic theme, so this might be the route you're looking to take.

if (preg_match("/(mobile|webos|opera mini)/i", $_SERVER['HTTP_USER_AGENT'])) {
    // Load mobile skin
} else {
    // Load desktop skin
}

Upvotes: 1

calsign
calsign

Reputation: 341

From a simple web search, I turned up this result: http://css-tricks.com/snippets/javascript/redirect-mobile-devices/ for a JavaScript implementation. It sets document.location to a different url if the width of the screen is less than 699.

Upvotes: 1

Zoltan Toth
Zoltan Toth

Reputation: 47687

Have you considered Media Queries ?

In that case you just editing the existing CSS file and don't need to bother with subfolders, mobile detection, redirects etc.

Upvotes: 1

Related Questions