Convert websites for mobile devices

hello guys,

im trying to convert my website for mobile devices that are using, for example, iOS or Android. i found http://www.convertwebsite.com/ while i was searching for a solution, and this service seems to be pretty much ok. now, before ill decide what ill do,can you tell me something better?

tnx. :slight_smile:

Why do you need to “convert” your site at all? A well-written site will be perfectly usable on a mobile phone browser. If you can give us some clues as to why your site in particular needs this conversion, we might be able to help you fix it so that it doesn’t need it!

my site, well its a blog, needs zoom in or out to fits on a iPhone for example, and this is not ok at all for my readers. So, i want to optimize my site’s theme in order to be easy to read from smartphones or tablets.

If you resize your browser while looking at the site you linked to, you’ll see that it changes shape dramatically based on browser width. This is done with CSS media queries. E.g.

@media screen and (max-device-width: 480px) {
  … styles for small screens here
}

They mainly work on fancy devices like the iPhone at this stage, but that’s a start.

Another method is to offer up very simple styles for all browsers, and then a nicer set of styles for browsers that can understand them via media queries as above.

Rethinking the Mobile Web by Yiibu

I recently made a mobile version of my site. I think Stevie might be right though. You may not need to convert it, but I think it’s a good skill to learn anyway.

What I did was made a new site basically, but in the CSS used, I set the width to 340px which works on most hand-held devices I believe (tried my Android, my dads BlackBerry, and my PSP). I then created a subdomain (mobile.mywebsite.com) for my redirects to go to. You’ll have to make sure that your mobile site is labeled something like “index” like your homepage in your mobile folder that you’ll probably be creating. Finally, I used a PHP script to redirect these devices that I found.

If this idea sounds good to you, I’ll have the PHP script posted below if you need it:



<?php

if(checkmobile()) header('Location:http://YOURMOBILESITE.com/');

function checkmobile() {

    if (isset($_SERVER['HTTP_X_WAP_PROFILE'])) return true;
    if (false !== stripos($_SERVER['HTTP_ACCEPT'], 'wap')) return true;

    $reject = array(
        'Creative AutoUpdate',
        'MSIE',
        'Trident',
        'Gecko'
    );
    
    $accept = array(
        'iphone',
        'midp',
        'j2me',
        'avantg',
        'docomo',
        'novarra',
        'palmos',
        'palmsource',
        '240x320',
        'opwv',
        'chtml',
        'pda',
        'windows ce',
        'mmp/',
        'blackberry',
        'mib/',
        'symbian',
        'wireless',
        'nokia',
        'hand',
        'mobi',
        'phone',
        'cdm',
        'up.b',
        'audio',
        'SIE-',
        'SEC-',
        'samsung',
        'HTC',
        'mot-',
        'mitsu',
        'sagem',
        'sony',
        'alcatel',
        'lg',
        'erics',
        'vx',
        'NEC',
        'philips',
        'mmm',
        'xx',
        'panasonic',
        'sharp',
        'wap',
        'sch',
        'rover',
        'pocket',
        'benq',
        'java',
        'pt',
        'pg',
        'vox',
        'amoi',
        'bird',
        'compal',
        'kg',
        'voda',
        'sany',
        'kdd',
        'dbt',
        'sendo',
        'sgh',
		'psp',
        'gradi',
        'jb',
        'moto'
    );
    
    $accept_regex = array(
        '[\\d]{3}i'
    );

    if (isset($_SERVER['HTTP_USER_AGENT'])) {
        // check for definite rejects
        foreach ($reject as $string) {
            if (false !== stripos($_SERVER['HTTP_USER_AGENT'], $string)) {
                return false;
            }
        }
        // more efficient accept check
        foreach ($accept as $string) {
            if (false !== stripos($_SERVER['HTTP_USER_AGENT'], $string)) {
                return true;
            }
        }
        // use regex only where necessary
        foreach ($accept_regex as $string) {
            if (preg_match('/'.$string.'/i', $_SERVER['HTTP_USER_AGENT'])) {
                return true;
            }
        }
    }

    return false;

}

?>


Some sites look good on the PSP though, so feel free to remove it.

I’m not a php programmer so this looked like just what was needed to redirect my users to the mobile version of the site. I copied Louie’s code to a test index page and looked at it on my Android phone. It does not show this [URL=“http://mobile.alsautomotiveandtruck.com”]mobile version of the page. Can someone point out what I’m missing? BTW, my client wants the simpler mobile version rather than the full website for the market he is targeting.