homepage Welcome to WebmasterWorld Guest from 54.145.243.51
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Handheld CSS
Hiding text on a handheld and vice versa
Phil_Payne

10+ Year Member



 
Msg#: 3252210 posted 9:03 am on Feb 14, 2007 (gmt 0)

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

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



 
Msg#: 3252210 posted 4:56 am on Feb 15, 2007 (gmt 0)

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

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3252210 posted 5:56 pm on Feb 15, 2007 (gmt 0)

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

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



 
Msg#: 3252210 posted 6:58 pm on Feb 15, 2007 (gmt 0)

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

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3252210 posted 11:41 pm on Feb 15, 2007 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved