Mobile Phone WEbsites

dingdongbubble

macrumors 6502a
Original poster
Jun 1, 2007
538
0
Hi

I am a beginner in WEb Designing and believe it or not I got started onl yesterday by following the link to HTML Dog on the post: Beginning Website design and DEvelopment.

I would like t ask you if it is possible to set your website's behaviour according to the browser viewing it? I want to do this so that my website can be viewed form mobile phones.

This idea came to my mind when I went to CSSEdit's website and copied their webpage source onto a text editor, removed the CSS link and saved it as an HTML. When I opened the file, the website was shockingly simple. It was the implementation of CSS which had made the website look gorgeous.

So I was wondering if it were possible for my website to not disable the CSS when a mobile phone browses onto it?
 

Mac In School

macrumors 65816
Jun 21, 2007
1,290
0
Yes, you can. You can do it via CSS or Javascript, but I would probably do it in a server-side language, so the extra code is transparent to people and spiders.
 

aaronbrethorst

macrumors member
Feb 1, 2007
30
0
Seattle, WA
Hi

I am a beginner in WEb Designing and believe it or not I got started onl yesterday by following the link to HTML Dog on the post: Beginning Website design and DEvelopment.

I would like t ask you if it is possible to set your website's behaviour according to the browser viewing it? I want to do this so that my website can be viewed form mobile phones.

This idea came to my mind when I went to CSSEdit's website and copied their webpage source onto a text editor, removed the CSS link and saved it as an HTML. When I opened the file, the website was shockingly simple. It was the implementation of CSS which had made the website look gorgeous.

So I was wondering if it were possible for my website to not disable the CSS when a mobile phone browses onto it?
In theory, the media attribute on the link tag should let you handle just this sort of scenario. Let's say you design a website and develop two separate stylesheets for it; one is targeted at regular computers and another is targeted at mobile devices.

For computers, you can get them to use your desktop-centric stylesheet by specifying media="screen" in the link tag where you bring in your CSS file.

For mobile devices, you should be able to (in theory) get them to use your mobile-centric stylesheet by specifying media="handheld". In practicality, this can be a total crapshoot.
 

angelneo

macrumors 68000
Jun 13, 2004
1,541
0
afk
On the server side script, you can just do a user agent check, this will roughly tell you what browser, phone or OS the user is running on. Bear in mind that it is possible to spoof other browsers or OS.