×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    2

    Browser detection

    hi all
    i need any script that can detect the browser type of a mobile device and redirect it to WML or XHTML

    thanx

  2. #2
    Registered User
    Join Date
    Jun 2004
    Location
    HEL
    Posts
    36

    Re: Browser detection

    There are many ways of doing this - what scripting language are you using?
    If you are using PHP, then take a look at this - it can be modified quite easily to check for WML too. IF you are nice, and show some effort as to how you have gone about this task, then I may even post a link to the code I use (PHP)
    Cheers,

    Jamie

    # Any form of employment is strictly prohibited ......

  3. #3
    Registered User
    Join Date
    Jan 2004
    Posts
    3

    Re: Browser detection

    Google for WURFL

  4. #4
    Registered User
    Join Date
    Oct 2005
    Posts
    11

    Re: Browser detection

    Hi,

    Browser can be detected by many ways but i would like to tell you the way which i use to store which mobile visit my wap site.

    Browser can be detected with Java but java with wml wont be easy so i would suggest you to use Server Side Lang. like PHP, ASP or Asp.net.

    You can use wml scripts in ASP like i do.


    ASP:

    <% Response.ContentType = "text/vnd.wap.wml" %>
    <?xml version="1.0" encoding="iso-8859-1"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
    <wml>
    <head>
    <meta http-equiv="Cache-Control" content="max-age=0" forua="true" />
    </head>
    <card id="LG" title="wap.bluemobiles.com">
    <% Set bc = Server.CreateObject("MSWC.BrowserType") %>
    Your Browser is : <%= bc.browser %>
    Version is : <%= bc.version %>
    </card>
    </wml>

    Save as the above script ".asp" upload to you site and visit thourgh your mobile it will show off the browser headers


    shnawer
    bluemobiles.com

  5. #5
    Registered User
    Join Date
    Oct 2005
    Posts
    11

    Re: Browser detection

    the last time i mentioned a script that use a component.
    if it dosnt work with you then use this

    <% If Instr(Request.ServerVariables("HTTP_USER_AGENT"),"Nokia") Then
    Response.Redirect "nokia.asp"
    elseIf Instr(Request.ServerVariables("HTTP_USER_AGENT"),"MOT-") Then
    Response.Redirect "motorola.asp"
    elseIf Instr(Request.ServerVariables("HTTP_USER_AGENT"),"Panasonic") Then
    Response.Redirect "panasonic.asp"
    elseIf Instr(Request.ServerVariables("HTTP_USER_AGENT"),"SAMSUNG-SGH-") Then
    Response.Redirect "samsung.asp"
    elseIf Instr(Request.ServerVariables("HTTP_USER_AGENT"),"SIE-") Then
    Response.Redirect "siemens.asp"
    elseIf Instr(Request.ServerVariables("HTTP_USER_AGENT"),"SonyEricsson") Then
    Response.Redirect "sonye.asp"
    elseIf Instr(Request.ServerVariables("HTTP_USER_AGENT"),"NEC-") Then
    Response.Redirect "nec.asp"
    elseIf Instr(Request.ServerVariables("HTTP_USER_AGENT"),"SHARP") Then
    Response.Redirect "sharp.asp"
    elseIf Instr(Request.ServerVariables("HTTP_USER_AGENT"),"LG") Then
    Response.Redirect "lg.asp"
    elseIf Instr(Request.ServerVariables("HTTP_USER_AGENT"),"MSIE") Then
    Response.Redirect "../wapinfo.asp"
    elseIf Instr(Request.ServerVariables("HTTP_USER_AGENT"),"Netscape") Then
    Response.Redirect "../wapinfo.asp"
    elseIf Instr(Request.ServerVariables("HTTP_USER_AGENT"),"Opera") Then
    Response.Redirect "../wapinfo.asp"
    else
    %>
    <% Response.ContentType = "text/vnd.wap.wml" %>
    <?xml version="1.0" encoding="iso-8859-1"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
    <wml>
    <head>
    <meta http-equiv="Cache-Control" content="max-age=0" forua="true" />
    </head>
    <card id="Default.asp" title="wap.bluemobiles.com">
    <p align="center">
    <img src="../blueimages/waplogo.gif"/><br/></p>
    <p align="left"><b>Welcome!, Menu</b><br/></p>
    <a href="midi.asp">Midi Tones</a><br/>
    <a href="mmf.asp">MMF (SMAF) Tones</a><br/>
    <a href="imy.asp">I-Melodies</a><br/>
    <a href="sendemail.asp">Send Email</a><br/>
    <a href="wallpapers.asp">Wallpapers</a><br/>
    <small>Sorry! Your Phone is not supported. But you still can use few options If you are know your phone support them</small>
    </card>
    </wml>
    <% End If %>

    save it as default.asp and visit thourgh different mobile it will aumatically detect the mobile and will redirect to the concerned page

    shnawer
    bluemobiles.com

  6. #6
    Registered User
    Join Date
    Nov 2005
    Posts
    1

    Exclamation Re: Browser detection

    Hi,

    I'm trying to develop a wap & xhtml version of my photography site www.christopherholt.com - I'm more photographer than developer, so am trying hard!

    The xhtml is in www.christopherholt.com/mobile/index.htm
    The wml is in www.christophehrolt.com/mobile/index.wml

    My problem had been how to get the phone to choose the wml or xhtml automatically, & I guess the ASP/PHP file would sort that out. Where would I put this though?

    Does it go in the actual xhtml & wml cards/files or does it sit on it's own in the root folder? Thanks for any help, whatsoever.
    Why isn't this stuff in the Nokia manuals btw?!
    Last edited by cmholt2002; 2005-11-30 at 13:54. Reason: xhtml & wml links

  7. #7
    Regular Contributor
    Join Date
    Jun 2004
    Location
    Hong Kong
    Posts
    59

    Re: Browser detection

    I'm more designer than developer. Welcome to visit my page.

    XHTML WAP: http://www.nowinlove.com/wap
    HTML: http://www.nowinlove.com

    Sorry for all, the version is for TC. SC and EN version is coming soon.

  8. #8
    Regular Contributor
    Join Date
    Jun 2004
    Location
    Hong Kong
    Posts
    59

    Re: Browser detection

    It is very hard to say. Although you detected the browser, but how can you control the screen width? I can just say, it is a trouble.

    Truly, my experience told me. Detect browser for internal use only is okay. Nothing can be proved.

    At my side, I choose to let visitors select the screen width if first visit.

  9. #9
    Registered User
    Join Date
    May 2005
    Posts
    2

    Re: Browser detection

    Hi,

    I'm implementing in Java. I have come accross similar problem. How to detect what version of WAP ( 1.0 or 2.0 ) does the browser handle? I know that with USER-AGENT header I may get the type of a browser. I wonder if there are some lists of browsers where it is pointed out which version of WAP does the browser handle.

    Thanks for help

    rypki

  10. #10
    Registered User
    Join Date
    Jan 2006
    Posts
    4

    Re: Browser detection

    Last edited by mikeyg11; 2006-01-18 at 10:56.

  11. #11
    Registered User
    Join Date
    Jan 2006
    Posts
    1

    Smile Re: Browser detection

    I need help and I too need help with browser detection but not for asp but for php and for a website...

    I am looking for a browser detection software that not only is written in php/or javascript but that also detects os (operating system) as well asd adjusts the website (height/width) to fit a standardize 600*800 screen resolution. I mentioned php because the site that I am working on for m company is on a linux server.

    http://www.evirtualworld.com/webdesi...and-design.php

    the main problem is that the style sheet doesnt work in opera or on a mac when viewed with Netscape browser...I would rather use .php file as opposed to javacript since that could cause some server site issues (some js is not supported across different browsers). Any suggestions?

    Robert

  12. #12
    Regular Contributor
    Join Date
    Jun 2004
    Location
    Hong Kong
    Posts
    59

    Re: Browser detection

    Hi Robert,

    You better don't want the CSS will work on all Mobile browsers. Actually, no standard in the mobile world. Pls forget it, use normal text to handle non-CSS browsers. Cheers!!

    Vincent

  13. #13
    Regular Contributor
    Join Date
    Jun 2004
    Location
    Hong Kong
    Posts
    59

    Smile Re: Browser detection

    Quote Originally Posted by cmholt2002
    Hi,

    I'm trying to develop a wap & xhtml version of my photography site www.christopherholt.com - I'm more photographer than developer, so am trying hard!

    The xhtml is in www.christopherholt.com/mobile/index.htm
    The wml is in www.christophehrolt.com/mobile/index.wml

    My problem had been how to get the phone to choose the wml or xhtml automatically, & I guess the ASP/PHP file would sort that out. Where would I put this though?

    Does it go in the actual xhtml & wml cards/files or does it sit on it's own in the root folder? Thanks for any help, whatsoever.
    Why isn't this stuff in the Nokia manuals btw?!
    Try to use:
    request.ServerVariables("HTTP_ACCEPT") to detect the browser support xhtml / wml.
    (for mobile only)

    String will return like the followings: (example of N6230)
    application/vnd.wap.wmlscriptc, text/vnd.wap.wml,application/vnd.wap.xhtml+xml, application/xhtml+xml,text/html,multipart/mixed, */*, text/vnd.wap.wmlscript


    Vincent

Similar Threads

  1. Replies: 1
    Last Post: 2005-03-10, 11:59
  2. Web browser as a control in my C++ App
    By natocm in forum Symbian User Interface
    Replies: 0
    Last Post: 2004-03-03, 16:38
  3. localhost support in 3650 WAP browser?
    By hansomaier in forum Symbian
    Replies: 1
    Last Post: 2004-01-13, 11:09

Posting Permissions

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