Welcome to WebmasterWorld Guest from 54.226.194.180

Forum Moderators: incrediBILL

Message Too Old, No Replies

Handheld CSS

Hiding text on a handheld and vice versa

     

Phil_Payne

9:03 am on Feb 14, 2007 (gmt 0)

10+ Year Member



I tried to reply to an appropriate thread last updated on 18 January, but it's already closed. Not yet a month?

Anyway - I'm going down the "one size fits all" route using a common CSS file for screens and handhelds. I'm testing on a Siemens S65 - plenty of storage, XHTML, supports the @media handheld approach and has a small enough display to make it a real challenge.

I've got it working. Even font-size: x-small works and the results are not bad.

Here's the tricky bit. The only place I'm currently differentiating between screen and handheld is in blocks within a common CSS file. Is it possible to drop text on one platform?

E.g., I have some fairly content-free headers (they merely repeat what's in other places on the page - no SEO benefit) that I'd like to render invisible on the handheld. Similarly, I'd like to put a WTAI tag on the handheld that would not be visible on the screen.

Can this be done with CSS - preferably in such a way that the Googlebot doesn't think I'm black-hatting?

JAB Creations

4:56 am on Feb 15, 2007 (gmt 0)

WebmasterWorld Senior Member jab_creations is a WebmasterWorld Top Contributor of All Time 10+ Year Member



You can "cloak" your page by detecting the useragent and serving content based on the useragent. For example this is how I detect various useragents to serve secondary "patch" CSS files.

PHP Example

<?php $useragent = $_SERVER['HTTP_USER_AGENT'];
if (eregi("Firefox/1.0", "$useragent")){echo 'Firefox Detected';?>

Cloaking is serving different code to different browsers. As far as I'm concerned it's legit if you're trying to aid the client but if Google cross checks your page with some other bot and you've changed say headers, images, and paragraphs based on the useragent then you might get a Google smack down.

Other people will not doubt jump on me or anyone else who mentions detecting by the useragent. First off the only people who spoof are spammers, people who think they're cool because they changed something, and lastly people who take privacy to extremes. Besides the spammers the other two groups are less common then iCab surfers.

If you need any more help just let me know.

- John

Robin_reala

5:56 pm on Feb 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So everyone who uses IE is a spammer then? Because it pretends to be Mozilla right at the very beginning. The awful state of today's UA strings is purely down to miscoded and non-updated browser sniffing.

JAB Creations

6:58 pm on Feb 15, 2007 (gmt 0)

WebmasterWorld Senior Member jab_creations is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I can agree with you that the lack of a user agent standard (minus my posted user agent standard) is simply unacceptable. However this does not mean one can't effectively detect based on the useragent among other things.

- John

Robin_reala

11:41 pm on Feb 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



At this particular moment in time with a bit of research you can use UA string detection effectively. But you shouldnít unless youíre willing to update your script on an extremely regular basis and donít publish it anywhere thatíll be archived.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month