8.7 My ASP code works on emulators but not on real browsers. What's wrong? |
In most cases emulators are not as strict as real WML browsers. This is especially true for those emulators that do not use real gateways (Nokia SDK/Toolkit), or those that do not use gateways at all (WinWAP, WapMAN). A real WML browser can only read the binary, tokenized form of WML, WMLC, and for the gateway to be able to convert/compile the textual WML code into WMLC, the syntax has been made very strict. ASP is designed for HTML browser, and HTML is nowhere near as strict as WML. There is a slight "bug" in ASP that makes it output whitespaces (such as spaces, carriage returns and line feeds) in places where WML says there cannot be any. Note that some gateways fix the problem by not passing the whitespaces through (CMG Gateway for instance). The following is a couple of lines of ASP code that usually starts the WML deck to send out MIME types etc:
<%Response.ContentType = "text/vnd.wap.wml"%> <?xml version="1.0"?> The problem with the code above is that ASP will output the carriage return/linefeed between .wml"%> and <?xml vers. The two lines are after all separated by a carriage return/linefeed. This will break the WML code because the absolute first character in a WML deck must be the < that starts the line <?xml version="1.0"?>. With the code above, the WML deck starts with a carriage return/line feed. The way to solve the problem is simply to put the two lines on the same line of code, like this:
<%Response.ContentType = "text/vnd.wap.wml"%><?xml version="1.0"?> After the XML definition is correctly formatted, WML is not that strict when it comes to whitespaces. Also note that some gateways have issues with content switching in ASP. Thus it is wiser to use Response.Write to produce output, rather than using <%=MyVar%> in the middle of your straight WML code. |
[ Main ] [ 08 - Troubleshooting ] |
© Copyright The Wireless FAQ. All Rights Reserved. Terms | Site Map |