0

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?

4

4 回答 4

1

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.

于 2012-08-28T00:29:41.160 回答
1

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.

于 2012-08-28T00:31:06.603 回答
1

我使用这个 PHP 语句来检查移动浏览器。我怀疑我所有的浏览器都有这个功能,但这是一个开始。您似乎拥有制作基本主题的专业知识,所以这可能是您想要采取的路线。

if (preg_match("/(mobile|webos|opera mini)/i", $_SERVER['HTTP_USER_AGENT'])) {
    // Load mobile skin
} else {
    // Load desktop skin
}
于 2012-08-28T00:33:52.067 回答
1

我正在为 php 站点使用 mobileesp,它工作得恰到好处,看来现在也可以使用 javascript 来做同样的事情。显然该网站有样品。希望这可以帮助:

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

于 2012-08-28T00:43:03.550 回答