且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

创建一个网站的移动版本

更新时间:2023-11-27 19:41:40

这些是一些提供本机的外观和感觉上的WebKit的iPhone专用库:

These are some of the iPhone specific libraries that provide a native look and feel on webkit:

  • iUi
  • jQTouch
  • Sencha Touch
  • iWebkit

得到它的工作在大多数手机上肯定会是一个问题,因为它们是建立在与iPhone的屏幕尺寸大多数图书馆(小320x480)记在心里。

Getting it to work on most phones will definitely be an issue with most libraries as they are built around with the iPhone's screen size (320x480) in mind.

要获取设备,包括Android和J2ME手机,结账雅虎蓝图的覆盖面更广。这是一种标记语言,翻译为多种平台和设备。

To get a wider coverage of devices including Android and J2ME phones, checkout Yahoo Blueprint. It's a markup language that translates for various platforms and devices.

您既可以获取基于用户代理的移动浏览者随地吐痰页面时动态切换样式表的服务器上。这不是一个推荐的做法,虽然为重型页面,你仍然会被发送数据的大块,不会被渲染。或者,如果你有你的观点明确分开,你可以模板化基于用户代理和/或其它参数的看法。这与只更改视图保持你的控制器逻辑在一个地方的优势。您可以使用iPhone / iPod Touch和开关上面的库更简单的移动版本的其他智能手机或调整它,只要你想。

You could either get the mobile view based on User Agent by dynamically switching the stylesheet on your server when spitting the page. This is not a recommended approach though for heavy-duty pages as you will still be sending huge chunks of data that would not be rendered. Alternatively, if you have a clear separation of your views, you can templatize the view based on User Agent and/or other parameters. This has the advantage of keeping your controller logic in one place with only changing views. You could use the above libraries for iPhone/iPod Touch and switch to a simpler mobile version for other smartphones or tweak it as you want.

创建网站的一个单独的移动版本可以苦心很难改变的时候出现的维护。

Creating a separate mobile version of the site can be painstakingly difficult to maintain when changes arise.

在iPhone和Android模拟器是因为它得到真正的交易接近。在iPhone不会让你做的东西一样让在模拟器上显而易见的原因呼叫,但Android提供了模拟的实现基本上是所有设备上。

The iPhone and Android simulators are as close as it gets to the real deal. The iPhone won't let you do stuff like make calls on the simulator for obvious reasons, but the Android provides mock implementations for basically everything on the device.