×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    18

    WAP architecture

    I have a particular issue about the WAP architecture. I don't underststand if it's possible to develop a web app with an url (e.g. www.sitename.com) and use the same url to allow the user connecting to tha wap version of that web application (instead of wap.sitename.com). I have this particular need for promotional reasons (think about a poster in the metro in wich is presented this site, the user can be annoyed by multiple urls dependent from the device, PC or phone). Can anyone explain me if there's a solution?

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    1

    RE: WAP architecture

    Yes. When requesting a page the browser will send its name in the user agent header of the HTTP request. You can therefore write a script that returns the content in either WML or HTML (or XHTML) depending on the type of browser the user is using.

    For example if you are running Microsoft IIS you could create two directories that map to:

    http://www.sitename.com/Web
    http://www.sitename.com/Mobile

    You could then create http://www...com/Default.asp (that being the file executed if no file is specified) as follows:

    <% If InStr(Request.ServerVariables("HTTP_USER_AGENT", "Mozilla&quot Then
    Response.Redirect("Web&quot
    Else
    Response.Redirect("Mobile&quot
    End If %>

    This would redirect browser that have "Mozilla" in their user agent header to the "Web" directory and all other browsers to the "Mobile" directory.

    Browsers also send a list of file types they support in the request header. Another solution would be to detect if the browser supported HTML, for example:

    <% If InStr(Request.ServerVariables("HTTP_ACCEPT&quot, "text/html&quot Then
    Response.Redirect("Web&quot
    ElseIf InStr(Request.ServerVariables("HTTP_ACCEPT&quot, "text/vnd.wap.wml&quot Then
    Response.Redirect("Mobile&quot
    Else
    ' Give them HTML anyway...
    Response.Redirect("Web&quot
    End If %>

    I hope that was of some help.


    Andrew

Posting Permissions

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