Most efficient way to cater for different web devices?

霸气de小男生 提交于 2019-12-12 17:05:05

问题


Folks voting to close as not constructive, read the whole thing please. Specific questions at the end. Looking for real world examples and approaches.

Context

With numerous devices like smart-phones, tablets being used increasingly to access the web its important to plan, design (responsively) and develop (esp. your front end) to give the devices a fast and tailored user experience.

There's some amazing sites being built. Have a look at mediaqueri.es (resize your browser)

We see approaches such as

  • big screen first, then target smaller devices.
  • mobile first then media queries to spice things up for bigger screens.
  • device detection with different techniques (including server side)
  • and serving completely different markup and content to devices.

Question(s)

What are you folks doing out there today? Why did you choose your approach and most importantly if it isn't the most efficient approach to tackle this, then what is?

Things I'm looking for:

  • Is it a pure CSS / JS / HTML approach, or server side, or a combination - why?
  • Each device gets only the resources (images etc.) that it needs so it performs well
  • Maintenance of the site is easier, i.e. adding / changing features is not a huge pain
  • Some code samples are always useful
  • lets leave out old shitty browsers like ie7 and below

回答1:


I think what you are looking for is Responsive Web Design.

See:

http://www.alistapart.com/articles/responsive-web-design/
http://coding.smashingmagazine.com/2011/01/12/guidelines-for-responsive-web-design/

Responsive Web Design (using CSS) does not necessarily address performance issues but is a good starting point. Keeping in mind that premature optimization is the root of all evil, you can profile your users and bandwidth and determine where you need to optimize once you have a working design in place.

For a discussion of some of the downsides, e.g., image resizing in the browser (you can work around this with CSS and/or AJAX, though), see:

http://www.webdesignshock.com/responsive-design-problems/




回答2:


You will want to use a framework like PhoneGap. HTML evolves slowly but every day, about 10 new devices with new bugs "features" hit the market and you innocent app - there simply is no way for a small group of people to handle the necessary work.

As for different devices, there are two trouble areas:

  1. Screen sizes
  2. Render bugs

For screen sizes, there are pretty cool solutions today. For example, some frameworks add the CSS style "640x400" or "480x800" to the body element. That makes it dead simple to style elements depending on the screen size. Or you can use JavaScript pull in the matching style sheets.

For render bugs, you'll need workarounds. As I said above, this is nothing a single person or a small group can handle. Every few months, there is a new version of Android with a new render engine and new "features". You fix problems for one of them and break ten others at the same time. Select a framework which plays well with many devices and which is open to changes (read: avoid anything proprietary).

That way, you get solutions for the common problems and you can fix small issues yourself.




回答3:


I would definately recomment RedFilters Answer (+1).

I just wanted to add some libraries which you might find interesting relating to this topic. They involve Browser feature detection & conditional resource loading. check them out:

http://www.modernizr.com/

http://yepnopejs.com/



来源:https://stackoverflow.com/questions/7890840/most-efficient-way-to-cater-for-different-web-devices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!