| Reply | « Previous Thread | Next Thread » |
|
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. Code-- <!-- var strNav = navigator.userAgent; //alert(strNav); if((strNav.indexOf("Nokia" >-1) | (strNav.indexOf("Toolkit" >-1) | (strNav.indexOf("XHTML" >-1)){ window.location="index.xhtml"; } //--> 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.. |
|
Hi,
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" , "wml" thenResponse.Redirect("wml_page_here.wml" ![]() else Response.Redirect("html_page_here.html" ![]() 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" , "Nokia" thenResponse.Redirect("nokia.wml" ![]() ... Hope this helps, Mika / Forum Nokia Developer Support |
|
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. |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|