1. Trang chủ
  2. » Công Nghệ Thông Tin

Webmaster''''s Guide to the Wireless Internet part 13 pot

10 235 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 125,63 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Here is an example of how an element containing two attributes would appear: text WARNING As you can see in the example in this section, there is a space between each attribute.. NOTE Fo

Trang 1

Response.AddHeader "Cache-Control", "no-cache, must-revalidate"

Response.AddHeader "Pragma", "no-cache"

%>

NOTE

In addition to checking how the individual device handles caching, be aware that WAP gateways may employ caching technology as well, which can be harder to identify.

Bookmarking

Bookmarking works much in the same way as Web browsing, allowing a user to mark a page of interest so that they can return directly to the page at a later date Sometimes you may not want a user to bookmark your page (such as when the URL also contains information specific to that particular session).You can control bookmarking on the Openwave platform with the following meta information:

<meta name="vnd.up.markable" forua="true" content="false"/>

Understanding the Deck of Cards Paradigm

A WML file uses a “deck of cards” paradigm to structure content.Think of each file as a deck, within which are any number of cards Each card is a single page that can be displayed on the device A simple WML file containing two cards within the deck would look like the following:

<?xml version="1.0"?>

<!DOCTYPE wml PUBLIC "//WAPFORUM//DTD_WML_1.1//EN"

http://www.wapforum.org/DTD/wml_1.1.xml>

<! Start of the deck >

<wml>

<! Card 1 >

<card>

</card>

<! Card 2 >

Trang 2

</card>

<! End of the deck >

</wml>

Decks are extremely handy for sending the user groups of pages that they are likely to access, meaning that the user has to make only one connection to download several separate cards

WML Elements

The previous example introduced the concepts of decks and cards.You may have

noticed that the structure of the deck looked a lot like HTML In fact,WML is quite similar to HTML in its use of elements and attributes to describe the con-tent within each file.The <wml> and <card> elements in the example are just two examples of the elements you’ll find in the WML language

Adding Attributes

Most WML elements have at least one attribute that you can use to define parameters that specify how the device should handle the element.The element’s attribute(s) are placed in the opening element and an attributes’ values are

enclosed in either single quotes (') or double quotes (") Here is an example of how an element containing two attributes would appear:

<element attribute1="value1" attribute2="value2">text</element>

WARNING

As you can see in the example in this section, there is a space between each attribute This is required in the WML specification; failure to sepa-rate each element with a space will cause the WML to fail to load.

You will see that most of the elements in the WML Elements section of this book contain several different attributes that you can set to specify how the element will be used

Trang 3

The id and class Attributes

The id and class attributes respectively allow specific elements or groups of ele-ments to be individually identified and manipulated An id may be assigned only once within a particular deck and is thus unique in that instance, whereas a class

may be assigned to many different elements within the deck and is thus useful for

grouping similar elements.You can have multiple class names within the class attribute, but these should be separated by white space A class is case-sensitive, so

class1 and Class2 are two separate entities.

NOTE

For each WML element detailed in the sections following this one, a table shows the various attributes that each element can contain.

Because id and class are core attributes that can be applied to any WML

element, for the sake of repetition, they will not be shown within each individual element attribute table.

The <a> Element

The <a> element is an abbreviated form of the <anchor> element.Text within the <a> element forms a hyperlink to another card or deck It is preferable to use <a> instead of <anchor> wherever possible.You cannot nest the <a> ele-ment, and it may only contain either a <br> or <img> element.The following is

an example of the syntax for the <a> element:

<a href="deck2.wml">A Link to Deck 2</a>

The href attribute is required All other attributes are optional See Table 3.2

for a list of attributes for the <a> element

Table 3.2Attributes for the <a> Element

href The target location for the link

Trang 4

The <access> Element

The <access> element allows the author to control how the deck is accessed from other areas.You should consider the use of an <access> element when the privacy and security of the information being accessed is important.The use of variables within WML (a situation that does not exist within HTML) could theo-retically allow malicious manipulation of information By restricting access at the deck level, the user’s information can be kept private

The <access> element works by specifying which particular domains and/or paths are allowed to access the deck.When the deck is accessed, the user agent checks to see whether the requested destination is allowed access from the cur-rent deck If the domain and/or path do not match those specified, access is not allowed

Domains are evaluated according to suffix order.Thus, www.thedomain.com is a match for thedomain.com, but domain.com will not match Similarly, paths are matched according to prefix.Thus, /path/path/ will match path/path but /pathpath will not.

The default for the domain attribute is the domain where the current deck is

located, and the path attribute defaults to “/” A deck may contain only one

<access> element See Table 3.3 for a list of attributes for the <access> element

Table 3.3 Attributes for the <access> Element

path The particular path that may access the deck

The following is an example of the syntax for the <access> element:

<access domain="domain.com" path="/path"/>

In this example, the referring Uniform Resource Identifier (URI) would be allowed access to the deck: http://domain.com/path/deck.wml

The <anchor> Element

The behavior of the <anchor> element is specified by the task it contains A task

can be thought of as an action that must be performed as a result of the user selecting the element In the case of the <anchor> element, this can be either

<go>, <prev>, or <refresh>, but must consist of one task only <Anchor> ele-ments cannot be nested See Table 3.4 for a list of attributes for the <anchor>

Trang 5

Table 3.4Attributes for the <anchor> Element

The following is an example of the syntax for the <anchor> element:

<anchor>

A link to Deck 2

<go href="deck2.wml">

</anchor>

As you can see, this example uses a <go> task to perform the same task as the example given for the <a> element

NOTE

For both the <a> and <anchor> elements, the URI can be relative or absolute Additionally, URL fragments are identified in the same way as

anchors in HTML by using the # identifier.

The <b> Element

The <b> element signifies that the text contained within should be rendered by the user-agent as a bold font Note that many WML microbrowsers do not render text marked up as bold with a bold font, so if you are relying on con-veying meaning with bold, check with the target device for conformity

It is perhaps a better idea (and is suggested within the WML specification) that text should use <strong> or <em> elements instead, resorting to using <b> only where specific control of the text is required.This will be familiar to anyone who has studied the use of <bold> versus <strong> within HTML.Table 3.5 lists the attribute for the <b> element

Table 3.5Attribute for the <b> Element

Trang 6

The following is an example of the syntax for the <b> element:

This text is normal text, but <b>this text is bold text!</b>

The <big> Element

The <big> element indicates that the user-agent should render the text in a larger font size than the base font size for the device.Table 3.6 lists the attribute for the <big> element

Table 3.6Attribute for the <big> Element

The following is an example of the syntax for the <big> element:

This text is a normal size <big>but this text is bigger!</big>

The <br/> Element

The <br/> element forces a line break wherever it is placed within the text

Table 3.7 lists the attribute for the <br/> element

Table 3.7Attribute for the <br/> Element

The following is an example of the syntax for the <br/> element:

This is on one line.<br/>This is on the next line.

The <card> Element

Each WML deck can contain one or more cards.The <card> element acts as a container for text and other elements that together form discrete units for display

in a device.The id of a card can be used as the target for a fragment identifier

within any navigation element See Table 3.8 for a list of attributes for the

<card> element

Trang 7

Table 3.8Attributes for the <card> Element

should reinitialize upon entry The default value is false.

a result of a <prev> task.

a result of <go> task.

content of the card should be displayed in an ordered fashion The default value is true.

by the user-agent to provide meaning to the user for the purpose of the card and should be kept short and descriptive.

The following is an example of the syntax for the <card> element:

<card title="A New Card" newcontext="true">

This is a card.

</card>

All attributes of the card element are implied—that is, they are not absolutely necessary:

<card>

This is a card.

</card>

This code is just as valid as the prior example However, you should at least include a title in all of your cards if only to give users some sort of indication what the card is about

The <do> Element

In certain situations, you may want to interact with the user in some way.The

<do> element provides an interface to initiate actions from your users at the deck or card level If the <do> element is present at the deck level, it can be

Trang 8

contained within a template element to provide the same functionality to all cards within the deck A <do> within a card will override a <do> within the parent deck if they share the same name

Exactly how the interface is rendered to the user is entirely dependent of the device, and the <do> may take the appearance of a soft button, a link, or choice

through the menu system.You can use the type attribute to provide some

indica-tion to the user-agent as to the intended use of the <do> element See Table 3.9 for a list of attributes for the <do> element

Table 3.9Attributes for the <do> Element

name The name of the event binding.

be ignored by the user-agent.

type The intended function for which the element is intended.

NOTE

The type attribute is required and must be specified at all times Note

that the <do> element may not be rendered where it is placed within the text of the card In fact, the only safe assumption you can make is that the user-agent will map the element to a specific user interface This can cause problems because the <do> element can appear at the top of the rendered card, at the bottom, in the middle—in fact just about any-where—so you must carefully consider the use of the <do> element with respect to the target device.

The following is an example of the syntax for the <do> element:

<do type="accept" label="Next Card">

<go href="#nextcard"/>

</do>

Trang 9

The <em> Element

The <em> element specifies that the text should be rendered by the user-agent with emphasis.Table 3.10 lists the attribute for the <em> element

Table 3.10Attribute for the <em> Element

The following is an example of the syntax for the <em> element:

This text is normal but <em>this text is emphasized</em>.

The <fieldset> Element

The <fieldset> element is useful for grouping similar fields and text together

to allow better representation of the contents on the target device.You can nest further <fieldset> elements to provide more information on how the fields and text relate to each other See Table 3.11 for a list of attributes for the <fieldset> element

Table 3.11Attributes for the <fieldset> Element

describe the contents of the fieldset, and may also be rendered by the user-agent to provide information on the content to the user.

The following is an example of the syntax for the <fieldset> element:

<fieldset title="Ice-Creams">

Strawberry<br/>

Vanilla<br/>

Chocolate

</fieldset>

Trang 10

The <go> Element

The <go> element is a task that specifies navigation to a URI.The href attribute

is required See Table 3.12 for a list of attributes for the <go> element

Table 3.12Attributes for the <go> Element

accept The default is to use the character set the deck was sent in.

reloaded from the server This allows new values to be set and sent to the server in the case of submissions sending data pairs.

specifies the content type that the submission should

be sent as The default value is

application/x-www-form-urlencoded.

href The destination that should be navigated to.

as the submission method used in HTTP.

must send the URI of the deck that contains the<go>

element to the server This allows access controls to be exercised.

The following is an example of the syntax for the <go> element:

<go href="card1.wml"/>

You can find further examples of navigating using the <go> element later in this chapter in the section called “Creating WML Content.”

The <head> Element

The <head> element contains data relating to the deck as a whole.The following

is an example of the syntax for the <head> element:

<head>

<access domain="domain.com"/>

</head>

Ngày đăng: 04/07/2014, 02:20

TỪ KHÓA LIÊN QUAN