Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 21
  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    5
    Member #
    31869
    Hello,

    I recently updated a website, it is fixed and uses a table as an outer shell. I would now like to build a mobile website. Can I build a splash page which lets the user choose whether they want to view the desktop version or mobile version of the website, this way it is all on the same web address.

    What are all the code to target all mobile devices? Do I need to design multiple sized layouts to be able to target all mobile devices? What are the pixel sizes recommended?

    Thanks,

  2.  

  3. #2
    Junior Member MichaelRoe's Avatar
    Join Date
    May 2012
    Location
    Brisbane, Australia :D
    Posts
    12
    Member #
    31866
    Liked
    1 times
    I would suggest a m.yourwebsitehere.com subdomain, and allowing the user to redirect to that by default on a mobile device. (It would be pretty simple to determine if a user is accessing the website by mobile device or PC).

    It would take the same amount of coding as your splash page idea, you would just need to add a sub-domain to your pre-existing domain, which is free.

    As for your question about how to fit the demensions of the mobile site to the demensions of the movile device, I'm not too sure. Perhaps you could use a code to check the browser the mobile device is using and reference that to the demensions for that particular browser? I don't know, someone else will have to answer that for you.

  4. #3
    Senior Member medlington's Avatar
    Join Date
    Nov 2005
    Location
    Sheffield, UK
    Posts
    377
    Member #
    11968
    Liked
    4 times
    Hi,

    Most mobiles I've used seem to scale the content to fit anyway but you could always define everything as % rather than px.

    As for the Splash page that would work fine and just have the mobile version of your site in a separate folder or on a sub-domain.

    It would probably be better though if you have a browser detection script running that redirected the user automatically based on which browser they're using, either that or it loads a different stylesheet depending upon the browser

  5. #4
    Junior Member MichaelRoe's Avatar
    Join Date
    May 2012
    Location
    Brisbane, Australia :D
    Posts
    12
    Member #
    31866
    Liked
    1 times
    Quote Originally Posted by medlington, post: 236896
    Hi,

    Most mobiles I've used seem to scale the content to fit anyway but you could always define everything as % rather than px.

    As for the Splash page that would work fine and just have the mobile version of your site in a separate folder or on a sub-domain.

    It would probably be better though if you have a browser detection script running that redirected the user automatically based on which browser they're using, either that or it loads a different stylesheet depending upon the browser
    Yeah the scaling content size is a good idea as well, and would probably be more efficient, but possibly annoying to reconfigure the design.
    david999 likes this.

  6. #5
    Junior Member
    Join Date
    May 2012
    Posts
    5
    Member #
    31869
    The thing with having a script that redirects the user to the write layout is that I only have a basic package and it doesn not support php. I'm just trying to find the cheapest route to take to make this work.

    What are all the scripts that redirect the users to all mobile devices?

  7. #6
    Junior Member
    Join Date
    May 2012
    Posts
    5
    Member #
    31869
    How many different layout designs do I need to make at what size to cater to all mobile devices?

  8. #7
    Junior Member MichaelRoe's Avatar
    Join Date
    May 2012
    Location
    Brisbane, Australia :D
    Posts
    12
    Member #
    31866
    Liked
    1 times
    Quote Originally Posted by darby1975, post: 236902
    How many different layout designs do I need to make at what size to cater to all mobile devices?
    Hundreds. There are too many devices to write different design scripts for. Instead you'll have to do the % width styling instead of px (in the CSS) to make it exactly the same for each mobile device.

    Also, here's a JavaScript code that will check the device screen width, and if it's below 699, it will redirect to a mobile page. By the way, I haven't tested this yet, so I don't know if it will work :P

    Code:
    <script type="text/javascript">
    <!--
    if (screen.width <= 699) {
    document.location = "m.yourwebsitehere.com";
    }
    //-->
    </script>
    You could also change the document.location = "m.yourwebsitehere.com" to change the external CSS file that you're using, thus removing the need for a subdomain...

  9. #8
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    http://mobiforge.com/developing/stor..._switcher=true

    I've used this free function several times

    I typically do a scaled down version of the site... With the pertinent information...

    Use a basic % based CSS file for styling and sizing of fonts...

    Since most iPhone and android smartphone render site decently without any interaction... Your first option should be "give the users a choice" mobile or desktop version... And using this script you can set a session variable to identify the user as a mobile visitor... Put a link on every page to go to the mobile version... Or if on mobile... Go to desktop version...

    Many are also using this script of they have an APP and send the visitor to the appropriate app store to download the app.

  10. #9
    Senior Member medlington's Avatar
    Join Date
    Nov 2005
    Location
    Sheffield, UK
    Posts
    377
    Member #
    11968
    Liked
    4 times
    I've just been trying to use that script but on my phone it comes up that its not a mobile device, the version I used was this:

    Code:
    <?php $mobile_browser = '0';  if (preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|pad|phone|android)/i', strtolower($_SERVER['HTTP_USER_AGENT']))) {     $mobile_browser++; }  if ((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml') > 0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))) {     $mobile_browser++; }      $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 4)); $mobile_agents = array(     'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',     'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',     'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',     'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',     'newt','noki','oper','palm','pana','pant','phil','play','port','prox',     'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',     'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',     'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',     'wapr','webc','winw','winw','xda ','xda-');  if (in_array($mobile_ua,$mobile_agents)) {     $mobile_browser++; } if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'macintosh') > 0) {     $mobile_browser = 0; } if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'linux') > 0) {     $mobile_browser = 0; } if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'windows') > 0) {     $mobile_browser = 0; } if ($mobile_browser > 0) {    header('Location: mobile/'); } else {    header('Location: main/'); }  ?>
    I realised that why it was failing was that in the user agent headers it had 'android' in it so was incrementing the variable but then it was testing true for having Linux in it after so it was then setting the variable back to 0.

    Ive swapped the code around a bit and it seems to work but can anyone see any problems with the new code? all I've done is move the first couple of lines to below the test for 'Linux'

    Code:
    <?php
    $mobile_browser = '0'; 
     
    $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 4));
    $mobile_agents = array(
        'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
        'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
        'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
        'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
        'newt','noki','oper','palm','pana','pant','phil','play','port','prox',
        'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',
        'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',
        'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',
        'wapr','webc','winw','winw','xda ','xda-'); 
    if (in_array($mobile_ua,$mobile_agents)) {
        $mobile_browser++;
    }
    if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'macintosh') > 0) {
        $mobile_browser = 0;
    }
    if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'linux') > 0) {
        $mobile_browser = 0;
    }
    if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'windows') > 0) {
        $mobile_browser = 0;
    }
    if (preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|pad|phone|android)/i', strtolower($_SERVER['HTTP_USER_AGENT']))) {
        $mobile_browser++;
    } 
    if ((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml') > 0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))) {
        $mobile_browser++;
    }    
    if ($mobile_browser > 0) {
      // header('Location: mobile/');
      
      echo "<h1>this is a phone!!!</h1>";
    }
    else {
     //  header('Location: main/');
       echo "<h1>this is a computer!!!</h1>";
    
    } 
    ?>

  11. #10
    WDF Staff AlphaMare's Avatar
    Join Date
    Oct 2009
    Location
    Montreal, Canada
    Posts
    4,570
    Member #
    20277
    Liked
    878 times
    HI - I'm moving this discussion out of Member Introductions, and into HTML/CSS.
    Good design should never say "Look at me!"
    It should say "Look at this." ~ David Craib


    http://digitalinsite.ca ~ my current site . . info@digitalinsite.ca ~ my email

    If you feel that someone's post helped you fix your problem, answered your question, or just made you feel better, feel free to "Like" their post. The "Like" link is at the bottom right of each post, along side the "reply" link. And if you are being helped here, try to help someone else - pass it on!


Page 1 of 3 1 2 3 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:17 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com