使用jQuery添加ToToHomescreen AddClass

Is it possible to add a class to a webapp if it's been added to the homescreen, on an iPhone for example.

This is so I can show certain content in the homescreen version than on the website.

Would this have to be done using server side code or could it be done using jQuery?

You can do it detecting the device dimensions to determine whether is an small screen device or you can try to detect the kind of device which is accessing.

In order to detect the resolution of the device you can use Javascript (or jQuery) or even CSS 3 using the @media queries.

jQuery example:

var windowsWidtdh = $(window).width();
var windowsHeight = $(window).height();

CSS 3 media queries:

/* Hidden the mobile extra info for desktop computers */
#mobileInfo{
    display:none;
}

/*Showing the mobile info for screen resolutions smaller than 640px*/
@media only screen and (max-width: 640px) {
    #mobileInfo{
        display:block;
    }
}

Modernizr adds a bunch of classes to the html of a document based on what features are available. I can't remember offhand if it will detect iOS (I suspect not) but it will tell you if you have a touchscreen to deal with.