Log in

View Full Version : If mobile show certain content?



pinehead
06-21-2010, 02:26 PM
I'm working on creating a mobile css page for my site. however, one thing i have not related to css is certain content such as video's that appear. I want to basically say "if it's on a mobile device don't show these images"

What is the best method to do so?

Thanks,

pinehead
06-21-2010, 08:56 PM
Since mobile ie6 and lower doesn't support media type, how to designate mobile css for those browsers?

djr33
06-22-2010, 12:24 AM
Note: your posts have been merged into a single thread. Don't post twice. It may take more than 6 hours to reply... please be patient.


While it is possible to do what you are suggesting, I don't think this is the right way to approach the problem.

I suggest that you create a mobile site like m.example.com and redirect users on mobile devices there, or just tell them to go there.

You can use a serverside language like PHP to check the user agent string and with some accuracy find out if they are on a mobile device. Alternatively you can use try to use Javascript to detect this, but that's not a good idea because many mobile devices may not use Javascript so that's not very useful.
I don't believe there is a way using only css to do this.

There might be a way to set a specific stylesheet for "mobile" as a default, but I expect that would only be recognized by some devices. Try google for "default mobile stylesheet" and see if you find anything. But again, that requires that the device uses it.