Results 1 to 2 of 2

Thread: Detecting mobile content

  1. #1
    Addicted Member
    Join Date
    Mar 06
    Location
    Manchester, England, UK
    Posts
    240

    Detecting mobile content

    This isn't specifically about mobile programming but more about detecting mobile content so I would guess mobile gurus can advise on this....

    Basically my VB.Net app is pulling down pages from servers using a webrequest. I parse these files to determine their content type etc.

    I want to detect mobile content which is easy for the likes of :

    <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN"
    "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
    "http://www.wapforum.org/DTD/wml12.dtd">
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD Compact HTML 1.0 Draft//EN">

    However looking at a few of the mobile frameworks (jquery to name one) they don't require any kind of signature. Having checked the content-type of a number of sites this also doesn't give anything away.

    I could parse the script tags and assume that if there is a framework attached it is in use, but this seems like a pretty ropey assumption and requires me to know about all frameworks.

    How would you propose that I detect if a page is a mobile one?

    Should developers really be adding a DOCTYPE as good practice?

  2. #2
    Addicted Member
    Join Date
    Mar 07
    Posts
    166

    Re: Detecting mobile content

    You could try changing the user agent string to something with the word "mobile" in it. Some sites detect a mobile browser by searching for the word. It works, too, unless the mobile user changed his user agent string to that of a desktop browser.
    Mitt Romney for US President! 2012 is his year!

    Check out my pins on Pinterest!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •