×

Discussion Board

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

    Default wml access on domain

    How do I send mobile visitors to my server to the wml page from the domain. eg. domain.com > domain.com/default.wml

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    466

    RE: Default wml access on domain

    Hi!

    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 MIME/media types they support in the request header. Another solution would be to detect if the browser suppors 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 %>

    Hope this was helpful for you!

    Kind regards,
    Satu/Forum Nokia Developer Support

Posting Permissions

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