1. Check out our app, Forums for Android! Download and leave feedback here!

Creating Mobile Webpages

Discussion in 'Android Devices' started by durkinm424, Feb 18, 2010.

  1. durkinm424

    durkinm424 Member
    Thread Starter
    5

    Dec 15, 2009
    9
    0
    5
    I'm not sure if this is a good area to post this, but maybe somebody can help me. I run a website for a restaurant, and am interested in making a mobile friendly site. I would like it to act like sites such as wikipedia, bank of america, and news outlets such as fox and cnn, where the user types in the regular url, and is automatically redirected to a mobile website, with an option at the bottom to view the full website. Any help would be appreciated. Do i need to create a .mobi? If so, how so.

    Links or advice is greatly appreciated, Thanks!
     

    Advertisement

  2. alostpacket

    alostpacket Over Macho Grande?
    513

    Nov 29, 2009
    7,978
    3,604
    513
    Android App Developer
    NY
    You'd be best off in the developer forum, but I can answer some of that.

    The way those sites redirect you to a mobile site is by reading what is called the user-agent string. It's basically the name of your browser. And, every time your browser connects to a website, it reports its user agent string to the server. For a Droid, it reports "Android."

    The servers for those websites are programmed with a server side programming language to read that string, and deliver different, more lightweight content, depending on if it matches a known mobile platform.


    .mobi domains have nothing to do with the above process, they are just for vanity's sake, and you do not need one unless you desire one.

    I could give you some further tips if you tell me more specifics about your experience with web technologies.

    Do you know HTML, CSS, XHTML, JavaScript, PHP, Java, C#, Ruby, Perl or anything similar?

    .
     
  3. durkinm424

    durkinm424 Member
    Thread Starter
    5

    Dec 15, 2009
    9
    0
    5
    Yea, i tried to post in the developer forum, but it did not allow me to. not sure why :(. But anyways...

    I do all the HTML coding for the website myself. I am self taught, but I have a fairly extensive knowledge of HTML. I do use CSS style sheets, and am pretty comfortable with that language as well. JavaScript I have used in the past and am comfortable with that as well.
     
  4. alostpacket

    alostpacket Over Macho Grande?
    513

    Nov 29, 2009
    7,978
    3,604
    513
    Android App Developer
    NY
    OK cool -- well you should be able to get the user-agent string from javascript and then you can dynamically load a CSS style sheet depending on what browser the user is on.

    It wont be a walk in the park but should be doable. There should be many extensive tutorials on how to sniff the user agent string with javascript and load different CSS based on the result.

    Some of the pages that come up in this search result should get you started:
    dynamically load css - Google Search

    This link should help a bit too:
    https://developer.mozilla.org/en/Browser_Detection_and_Cross_Browser_Support
     
  5. durkinm424

    durkinm424 Member
    Thread Starter
    5

    Dec 15, 2009
    9
    0
    5
    thanks a lot man, I'll look into these tomorrow.
     

Share This Page

Loading...