Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Mar 2003

    JavaScript problem

    Can't I use JavaScript in XHTML - i've been using the script below in head section but it doesn't seem to work. I've tried using it in body also but it doesn't work there also.

    Is JavaScript not supported - or what extra do i need to do?

    I'm using Nokia Mobile Internet Toolkit 3.1 to test and develop - Also, will the code that I write here give problems with Nokia 7650 phone.



    var strNav = navigator.userAgent;

    if((strNav.indexOf("Nokia&quot>-1) | (strNav.indexOf("Toolkit&quot>-1) | (strNav.indexOf("XHTML&quot>-1))




    If this doesn't work then how do i redirect a page depending on the requesting device and OS like if it is from a PC or Handheld etc..

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Tampere, Finland

    RE: JavaScript problem


    You can use JavaScript, but only terminal that currently supports it is Nokia 9210i. It is possible to download a web browser (http://www.reqwireless.com/webviewer.html) for 7650, but as far as I know, it does not support JavaScript. You can however test the XHTML pages which has JavaScript content in desktop web browser.

    If you have a web server running and would like to use ASP, here's a simple code how to redirect the user to wml/html page depending on the HTTP_ACCEPT environment variable.

    if InStr(Request.ServerVariables("HTTP_ACCEPT&quot, "wml&quot then
    end if

    The code assumes that the keyword "wml" is included in the MIME type strings (like text/vnd.wap.wml etc.). The MIME types must be set on the web server in order to make this work.

    User's browser can be identified from the HTTP_USER_AGENT -field:
    If InStr(Request.ServerVariables("HTTP_USER_AGENT&quot, "Nokia&quot then

    Hope this helps,
    Mika / Forum Nokia Developer Support

  3. #3
    Registered User
    Join Date
    Mar 2003

    RE: JavaScript problem

    since JavaSCript support is not there in all the mobile browsers so it is better to avoid using JS for page redirecting - it can be achieved by using inherent properties or methods of the scripting language being used - say redirect in ASP, header("Location: url" in PHP or sendRedirect in servlets or JSP.

Posting Permissions

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