30. What is the maximum size of a WML page?
1397 bytes/deck
31. What are the restrictions on WML pages?
Since WAP devices only have very little memory, there is a maximum WML deck boundary. There is no absolute standard here, which varies depending on the browser. Table 10-5 lists several browser restrictions.
Note that the size of WML deck refers to the size of the code compressed into binary format. A WML deck without compression may be large, but may be relatively small after compression.
Table 10-5 Restrictions for different browsers
Browser Compressed WML Size Limit
3.2 1492 bytes
2048 bytes
Ericsson R320 About 3000 bytes
Ericsson R380 About 3500 bytes
Ericsson MC218 More than 8000 bytes
Nokia 7110 1397 bytes
32. How to prevent illegal access to WML pages?
WAP can prevent illegal operations on files and directories through the HTTP protocol. Note: Some WAP emulators and virtual WAP browsers may not support this feature. At this time, it is not known whether it is possible to use other types of verification methods.
In order to use this method, the user's HTTP server must support this feature, and in fact most servers support it. When a WAP browser requests a URL, it will remind the user to enter the username and password. These are converted into characters that cannot be read directly, but are not encrypted. That is to say, if someone on the network is listening using the right device, the username and password will be leaked.
This feature is explained in detail in the Apache documentation, but the description of the documentation is very weak. Here are instructions on how to configure it on the Apache HTTP server:
Make sure that Apache has been configured so that a file named .htaccess can overwrite the global operation configuration. Operation configuration can be used either separate files in each directory or globally. But in this example, we will focus on the .htaccess file. And check the settings of AllowOverride. This must be set to AuthConfig, which means that Apache looks for the .htaccess file in the directory and uses the rules in that file. Remember to restart the Apache server after configuration.
The next step is to place the file that needs to be protected in the directory called .htaccess. (Note that the dot represents the beginning of the file name). The basic content of a .htaccess file is as follows:
AuthType Basic
AuthName "WAP FAQ Authentication Demo"
AuthUserFile /home/httpd/html/wap-faq/extras/auth/
require valid-user
AuthType setting specifies the type of verification, AuthName specifies the realm, AuthUserFile specifies the location of the password file, and require specifies the desired operation. In this example, any user in the password file has a correct password.
Now we need to generate a password file, and Apache uses a .htpasswd to complete the generation of this special format file. Run the program as follows:
#htpasswd /home/httpd/html/wap-faq/extras/auth/ demo
New password:
Re-type password:
Adding password for user demo
Note: When creating a file for the first time, the "-c" option must be used.
Now a user called "demo" has been joined and he has entered his password twice. Considering security reasons, password files should not be placed in the file root directory. The author is just a demonstration here.
Now the last one is to test it, and the author recommends using an HTML browser. Enter the address containing the URL directory you want to protect, and a dialog box will pop up to ask for the user name and password. If everything goes well, you can use the WAP browser to test it.
An example of directory protection is on this server. The user name is demo and the password is demo. You can use HTML or WML browsers to test it.
This example can also be obtained by inputting/.
Or just click on the protected area:
/wap-faq/extras/auth/
Or view the .htaccess file.
Finally, click to view the contents of the password file.
33. How to use non-Latin characters?
At the beginning of the file:
encoding="ISO-8859-1"?
or:
encoding="UTF-8"?
ISO-8859-1 and UTF-8 encodings support more characters.
34. What should I do if some special characters destroy the code and connection?
Anchor/link sometimes contains some characters other than letters and numbers. Typical examples are: "~" (wavy) and "&" (h) . If you program based on the book, you should tell the WAP browser what character set is used. This can be done in the XML definition:
<?xml version="1.0" encoding="iso-8859-1"?>
"iso-8859-1" is the Latin character set. This should meet the needs in most occasions. However, those escaped characters need to be escaped. Even if a character set is specified, it is useless.
Character entities are the standard names of certain special characters, such as: "&" means "&".
Most browsers have problems when decoding name entities. For example, Nokia lists 7 compatible name entities: "quot", "amp", "apos", "lt", "gt", "nbsp" and "shy". Only when using their decimal code (in the Link mentioned above), the browser can display almost all characters. If Nokia's browser receives an unsupported entity name, it crashes.
By using HTML or WML browser (in HTML format, although not very good), you can operate the online entity name list, which is in /wap-faq/apps/.
There is also an example in this table:/.
The first step is to select the character set to be used, Latin1, Latin1 Mathematical and Greek symbols, and finally Latin1 Markup symbols. I noticed that the list was split because of the limitation of deck. The real list shows the entity name, the entity's decimal value, and the real symbol. From here you can see which character can be displayed by the browser.
Pay attention to the online list above, do not set to "charset=iso-8859-1" (real Latin1), that is an XML definition.
35. Is it possible to display an optional Link on the WML page? When the user selects it, can he dial directly?
Not now. But once a device that supports WTAI appears, it is possible.
Previous page123Read the full text