4. World Wide Web (WWW)
• “The World Wide Web (known as "WWW', "Web" or
"W3") is the universe of network-accessible
information, the embodiment of human knowledge”
(W3C)
• The Web was created in 1989 by Tim Berners-Lee and
Robert Cailliau working at the European Organization
for Nuclear Research (CERN) in Geneva.
• The three basic components of the initial WWW
proposal:
HTML: Markup language for formatting hypertext
documents
URI: Uniform notation scheme for addressing accessible
resources over the network
HTTP: Protocol for transporting messages over the
network
6. Universal Naming with
Uniform Resource Identifier (URI):
• In the field of computer networking, a URI
scheme is the top level of the URI naming
structure.
• All URIs and absolute URI references are formed
with a scheme name, followed by a colon
character (":"), and the remainder of the URI
called the scheme-specific part.
• Every URI is defined as consisting of four parts, as
follows:
<schema name>:<hierarchical part?[?<query>][#<fragment>]
7.
8. • The scheme name consists of a sequence of
characters beginning with a letter and
followed by any combination of letters, digits,
plus ("+"), period ("."), or hyphen ("-").
Although schemes are case-insensitive, the
canonical form is lowercase and documents
that specify schemes must do so with
lowercase letters. It is followed by a colon
(":").
9. • The hierarchical part of the URI is intended to hold
identification information hierarchical in nature. Usually
this part begins with a double forward slash ("//"), followed
by an authority part and an optional path.
The authority part holds an optional user-information part,
terminated with "@" (e.g. username:password@); a hostname
(e.g., domain name or IP address); and an optional port number,
preceded by a colon ":".
The path part is a sequence of segments (conceptually similar
to directories, though not necessarily representing them)
separated by a forward slash ("/"). Historically, each segment
was specified to contain parameters separated from it using a
semicolon (";"), though this was rarely used in practice and
current specifications allow but no longer specify such
semantics.
10. • The query is an optional part, separated by a question mark ("?"),
that contains additional identification information that is not
hierarchical in nature. The query string syntax is not generically
defined, but it is commonly organized as a sequence
of <key>=<value> pairs, with the pairs separated by a semicolon or
an ampersand. For example:
•
• The fragment is an optional part separated from the front parts by
a hash ("#"). It holds additional identifying information that
provides direction to a secondary resource, e.g., a section heading
(in an article) identified by the remainder of the URI. When the
primary resource is an HTML document, the fragment is often
an id attribute of a specific element and web browsers will make
sure this element is visible.
14. Universal Naming Convention (UNC):
• UNC is the way to represent the path to a directory on a
networked computer. It is of the form:
<name of network computer>directory
i.e homedownloads
• Although the UNC address looks similar to a URL the two
are completely different. URLs use forward slashes rather
than the backslash and the initial forward slashes are
preceded by the transfer protocol (ftp, http) and a colon.
16. hypertext markup language (HTML)
• It is not a programming language. A markup language
specifies the layout and style of a document.
• A markup language consists of a set of markup tags.
• HTML tags are keywords surrounded by angle brackets
like <html>.
• Most HTML tags normally come in pairs like <b> and
</b>. The first tag is called the start tag (or opening
tag) and the second tag is called the end tag (or closing
tag).
• HTML documents are also called Web pages.
• The browser does not display the HTML tags, but uses
the tags to interpret the content of the page.
17. • A simple HTML document is given below:
<html>
<head>
<title>This is my first web page</title>
</head>
<body>
<h1>My first heading</h1>
<p>My first paragraph</p>
</body>
</html>
• Save this page with .html or .htm extension.
18. HTML Elements
• HTML documents are defined by HTML elements. An HTML element is
everything from the start tag to the end tag. For example, <p>My first
paragraph</p>. An HTML element consists of start tag, end tag, and
element content. The element content is everything between the start tag
and end tag. Empty elements are closed in the start tag. Most HTML
elements can have attributes. For example, src attribute of img tag.
HTML Attributes
• Attributes provide additional information about HTML elements.
Attributes are always specified in the start tag. Attributes come in
name/value pair like name = “value”. For example, HTML links are defined
with <a> tag and the link address is provided as an attribute href like <a
href = “http://www.tu.edu.np”>cdcsit</a>.
• Note: Always quote attribute values and use lowercase attributes.
19. • HTML Headings
• HTML headings are defined with the <h1> to <h6> tags. <h1> displays
largest text and <h6> smallest. For example, <h1>My first heading</h1>.
•
• HTML Paragraphs
• HTML paragraphs are defined with <p> tag. For example, <p>My first
paragraph</p>.
•
• HTML Rules (Lines)
• We use <hr /> tag to create horizontal line.
•
• HTML Comments
• We use comments to make our HTML code more readable and
understandable. Comments are ignored by the browser and are not
displayed. Comments are written between <!-- and -->. For example, <!--
This is a comment -->.
20. • HTML Line Breaks
• If you want a new line (line break) without starting a new paragraph, use <br />
tag.
•
• HTML Formatting Tags
• We use different tags for formatting output. For example, <b> is used for bold and
<i> is used for italic text. Some other tags are <big>, <small>, <sup>, <sub> etc.
•
• HTML Styles
• It is a new HTML attribute. It introduces CSS to HTML. The purpose of style
attribute is to provide a common way to style all HTML elements. For example,
<body style = “background-color:yellow”>, <p style = “font-family:courier new;
color:red; font-size:20px”>, <h1 style = “text-align:center”> etc.
•
(Have a review from Web technology !!! )
21. Dynamic HTML (DHTML)
• DHTML is the art of combining HTML, JavaScript, DOM,
and CSS and is NOT a language or a web standard.
• According to the World Wide Web Consortium (W3C):
"Dynamic HTML is a term used by some vendors to
describe the combination of HTML, style sheets and scripts
that allows documents to be animated."
• The W3C HTML 4 standard has rich support for dynamic
content:
HTML supports JavaScript
HTML supports the Document Object Model (DOM)
HTML supports HTML Events
HTML supports Cascading Style Sheets (CSS)
22. Wireless Markup Language (WML)
• WML, based on XML, is a markup language intended
for devices that implement the Wireless Application
Protocol (WAP) specification, such as mobile phones.
• It provides navigational support, data input, hyperlinks,
text and image presentation, and forms, much
like HTML (HyperText Markup Language).
• It preceded the use of other markup languages now
used with WAP, such as HTML itself, and XHTML (which
are gaining in popularity as processing power in mobile
devices increases).
23. WAP Binary XML (WBXML)
• WBXML is a binary representation of XML.
• It was developed by the WAP Forum and is now
maintained by the Open Mobile Alliance as a
standard to allow XML documents to be
transmitted in a compact manner over mobile
networks and proposed as an addition to
the W3C's WAP family of standards.
• WBXML is used by a number of mobile phones.
Usage includes SyncML (Synchronization markup
language) for transmitting address book and
calendar data etc.
24. WML Script
•
• WMLScript is the dialect of JavaScript used for WML pages
and is part of the Wireless Application Protocol (WAP).
• WMLScript is a client-side scripting language and is very
similar to JavaScript.
• Just like JavaScript WMLScript is used for tasks such as user
input validation, generation of error message and
other Dialog boxes etc.
• A major difference between JavaScript and WMLScript is
that JavaScript code can be embedded in
the HTML markup, whereas WMLScript code is always
placed in a file separate from the WML markup.
25. eXtensible Markup Language (XML)
• XML is designed to transport and store data and
is much like HTML.
• XML was designed to carry data, not to display
data.
• XML tags are not predefined. You must define
your own tags.
• XML is designed to be self-descriptive.
• It defines a set of rules for encoding documents
in a format that is both human-readable and
machine-readable.
26. • XML is not a replacement for HTML. XML and
HTML were designed with different goals:
XML was designed to transport and store data,
with focus on what data is.
HTML was designed to display data, with focus on
how data looks.
• HTML is about displaying information, while
XML is about carrying information.
27. • Maybe it is a little hard to understand, but XML does
not DO anything. XML was created to structure, store,
and transport information. The following example is a
note to Tulsi, from Giri, stored as XML:
<note>
<to>Tulsi</to>
<from>Giri</from>
<heading>Reminder</heading>
<body>Don't forget to bunk web tech class at Patan!</body>
</note>
28. XML Usages
XML is used in many aspects of web development, often to
simplify data storage and sharing.
• XML Separates Data from HTML:
• XML Simplifies Data Sharing:
• XML Simplifies Data Transport:
• XML Simplifies Platform Changes:
• XML Makes Your Data More Available:
• XML Used to Create New Internet Languages:
29. Extensible Hypertext Markup Language
(XHTML)
• XHTML is markup language used to create webpages.
• The first version of XHTML (1.0) was standardized in 2000.
• As HTML evolved over the first few decades of the web,
browsers became increasingly lenient in how they parsed
webpage source code. The result was that websites
were rendered inconsistently between browsers. One of
the main goals of XHTML was to ensure webpages looked
the same across multiple browsers.
• Since XHTML is based on XML rather than HTML, webpages
coded in XHTML must conform to a strict XML syntax.
30. XML Syntax Rules
• All XML Elements Must Have a Closing Tag.
• XML tags are case sensitive.
• XML Elements Must be Properly Nested.
• XML Documents Must Have a Root Element.
• XML Attribute Values Must be Quoted.
• Entity Reference.
• Comments in XML.
• White-space is preserved in XML.
(Have a review from Web Tech !!!)
31. WYSWIG Authoring Tool
• “What You See Is What You Get”.
• In such editors you edit not directly the source
code of your documents, but
its presentation as it (hopefully) will appear in
the final document.
• So instead of writing blocks of code manually
(as you would do it in Word or Latex), you
manipulate with design components using an
editor window.
32. Some of the WYSIWYG tools are
• ASP.NET Web Matrix
• Adobe Dreamweaver (formerly Macromedia
Dreamweaver)
• Amaya
• Microsoft Visual Studio
• Microsoft Visual Web Developer Express
33. A given HTML document will have an inconsistent
appearance on various platforms and computers for
several reasons:
• Different browsers and applications will render
the same markup differently
• Browsers and computer graphics systems have a
range of user settings
• Web browsers, like all computer software,
have bugs
• A single visual style can represent multiple
semantic meanings
34. WYSIWYM
• “What You See Is What You Mean”
• WYSIWYM is an alternative paradigm to
WYSIWYG, in which the focus is on the
semantic structure of the document rather
than on the presentation.
• These editors produce more logically
structured markup than is typical of WYSIWYG
editors, while retaining the advantage in ease
of use over hand-coding using a text editor.
36. CGI (Common Gateway Interface)
• How web browsers submit forms and interact
with programs on the server.
• Used for simple interactive applications
• Can be used with any programming languages
• Often called “CGI Scripts”
• Can be written in any programming language
• Run in the server, not in the web browser.
• Must follow server requiremnets for running
applications
• CGI is not a language in itself
37.
38. Perl:
• Practical Extraction and Reporting Language
• Perl is a high-level, general-purpose, interpreted, dynamic programming
language..
• Perl was originally developed by Larry Wall in 1987 as a general-
purpose Unix scripting language to make report processing easier.
• Perl borrows features from other programming languages
including C, shell scripting (sh), AWK, and sed.
• Perl gained widespread popularity in the late 1990s as a CGI
scripting language, in part due to its parsing abilities.
• In addition to CGI, Perl is used for graphics programming, system
administration, network programming, finance, bioinformatics, and other
applications.
• Its major features include support for multiple programming
paradigms (procedural, object-oriented, and functional styles), reference
counting memory management (without a cycle-detecting garbage
collector), built-in support for text processing, and a large collection of
third-party modules.
41. Ajax
• Asynchronous JavaScript and XML
• It is a group of interrelated web
development techniques used on the client-
side to create asynchronous web applications.
• With Ajax, web applications can send data to, and
retrieve data from, a server asynchronously (in
the background) without interfering with the
display and behavior of the existing page.
• Data can be retrieved using
the XMLHttpRequest object.
42. JSON
• Despite the name, the use of XML is not required.
• JSON is often used instead, JSON (or JavaScript Object
Notation), is a text-based open standard designed
for human-readable data interchange. Despite its
relationship to JavaScript, it is language-independent.
• Ajax is not a single technology, but a group of
technologies.
• JavaScript and the XMLHttpRequest object provide a
method for exchanging data asynchronously between
browser and server to avoid full page reloads.
44. • AJAX is based on internet standards, and uses a
combination of:
XMLHttpRequest object (to exchange data
asynchronously with a server)
JavaScript/DOM (to display/interact with the
information)
CSS (to style the data)
XML (often used as the format for transferring data)
• AJAX applications are browser and platform-
independent.
• The keystone of AJAX is the XMLHttpRequest
object.
45. Steps of AJAX Operation
1. A client event occurs
2. An XMLHttpRequest object is created
3. The XMLHttpRequest object is configured
4. The XMLHttpRequest object makes an
asynchronous request to the Webserver.
5. Webserver returns the result containing XML
document.
6. The XMLHttpRequest object calls the callback()
function and processes the result.
7. The HTML DOM is updated
46. The XMLHttpRequest Object
• All modern browsers support the XMLHttpRequest object which is
used to exchange data with a server behind the scenes.
• This means that it is possible to update parts of a web page,
without reloading the whole page.
• All modern browsers (IE7+, Firefox, Chrome, Safari, and Opera) have
a built-in XMLHttpRequest object.
Syntax for creating an XMLHttpRequest object:
variable=new XMLHttpRequest();
• Old versions of Internet Explorer (IE5 and IE6) uses an ActiveX
Object:
variable=new ActiveXObject("Microsoft.XMLHTTP");
47. Send a Request to a Server:
• To send a request to a server, we use the
open() and send() methods of the
XMLHttpRequest object:
xmlhttp.open("GET","ajax_info.asp",true);
xmlhttp.send();
48. Method Description
open(method,url,async) Specifies the type of request, the URL, and if the
request should be handled asynchronously or not.
method: the type of request: GET or POST
url: the location of the file on the server
async: true (asynchronous) or false (synchronous)
send(string) Sends the request off to the server.
string: Only used for POST requests
49. GET or POST?
• GET is simpler and faster than POST, and can
be used in most cases. However, always use
POST requests when:
A cached file is not an option (update a file or
database on the server)
Sending a large amount of data to the server
(POST has no size limitations)
Sending user input (which can contain unknown
characters), POST is more robust and secure than
GET
50. GET Requests
• A simple GET request:
• If you want to send information with the GET method, add the information to the
URL:
xmlhttp.open("GET","demo_get2.asp?fname=Henry&lname=Ford",true);
xmlhttp.send();
• The url - A File On a Server
• The url parameter of the open() method, is an address to a file on a server:
xmlhttp.open("GET","ajax_test.asp",true);
• The file can be any kind of file, like .txt and .xml, or server scripting files like .asp
and .php (which can perform actions on the server before sending the response
back).
51. Asynchronous - True or False?
• AJAX stands for Asynchronous JavaScript and XML, and for the
XMLHttpRequest object to behave as AJAX, the async parameter of
the open() method has to be set to true:
xmlhttp.open("GET","ajax_test.asp",true);
• Sending asynchronous requests is a huge improvement for web
developers. Many of the tasks performed on the server are very
time consuming. Before AJAX, this operation could cause the
application to hang or stop.
• With AJAX, the JavaScript does not have to wait for the server
response, but can instead:
execute other scripts while waiting for server response
deal with the response when the response ready
52. Async=true
• When using async=true, specify a function to execute when
the response is ready in the onreadystatechange event:
Example
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.re
sponseText;
}
}
xmlhttp.open("GET","ajax_info.txt",true);
xmlhttp.send();
53. Async=false
• To use async=false, change the third parameter in the
open() method to false:
xmlhttp.open("GET","ajax_info.txt",false);
• Using async=false is not recommended, but for a few
small requests this can be ok.
• Remember that the JavaScript will NOT continue to
execute, until the server response is ready. If the server
is busy or slow, the application will hang or stop.
54. • Note: When you use async=false, do NOT
write an onreadystatechange function - just
put the code after the send() statement:
Example
xmlhttp.open("GET","ajax_info.txt",false);
xmlhttp.send();
document.getElementById("myDiv").innerHTML
=xmlhttp.responseText;
55. Server Response
• To get the response from a server, use the
responseText or responseXML property of the
XMLHttpRequest object.
Property Description
responseText get the response data as a string
responseXML get the response data as XML data
56. The responseText Property
• If the response from the server is not XML,
use the responseText property. The
responseText property returns the response as
a string, and you can use it accordingly:
Example
document.getElementById("myDiv").innerHTML
=xmlhttp.responseText;
57. The responseXML Property
• If the response from the server is XML, and you want to
parse it as an XML object, use the responseXML property:
• Request the file cd_catalog.xml and parse the response:
xmlDoc=xmlhttp.responseXML;
txt="";
x=xmlDoc.getElementsByTagName("ARTIST");
for (i=0;i<x.length;i++)
{
txt=txt + x[i].childNodes[0].nodeValue + "<br />";
}
document.getElementById("myDiv").innerHTML=txt;
58. The onreadystatechange event
• When a request to a server is sent, we want to
perform some actions based on the response.
• The onreadystatechange event is triggered
every time the readyState changes.
• The readyState property holds the status of
the XMLHttpRequest.
• Three important properties of the
XMLHttpRequest object:
59. Property Description
onreadystatechange Stores a function (or the name of a function) to be
called automatically each time the readyState property
changes
readyState Holds the status of the XMLHttpRequest. Changes from
0 to 4:
0: request not initialized
1: server connection established
2: request received
3: processing request
4: request finished and response is ready
status 200: "OK"
404: Page not found
60. • In the onreadystatechange event, we specify what will happen
when the server response is ready to be processed.
• When readyState is 4 and status is 200, the response is ready:
Example
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
• Note: The onreadystatechange event is triggered four times, one
time for each change in readyState.
61. Using a Callback Function:
• A callback function is a function passed as a parameter to another function. If you
have more than one AJAX task on your website, you should create ONE standard
function for creating the XMLHttpRequest object, and call this for each AJAX task.
• The function call should contain the URL and what to do on onreadystatechange
(which is probably different for each call):
Example
function myFunction()
{
loadXMLDoc("ajax_info.txt",function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
});
}
62. Ajax framework:
• In web application development, an Ajax framework is
a framework which leverages Ajax, a collection of
technologies for building dynamic web pages on the client
side. While data is read from and sent to the server by
JavaScript requests, frameworks may include server-
side or client-side components to process the client's
requests.
• Some of the frameworks are JavaScript compilers, for
generating JavaScript and Ajax that runs in the web
browser client; some are pure JavaScript libraries; others
are server-side frameworks that typically utilize JavaScript
libraries.
• For examples; jquery, Moo Tools etc.
64. The browser's main components are:
• The user interface - this includes the address bar,
back/forward button, bookmarking menu etc.
Every part of the browser display except the main
window where you see the requested page.
• The browser engine - the interface for querying
and manipulating the rendering engine.
• The rendering engine - responsible for displaying
the requested content. For example if the
requested content is HTML, it is responsible for
parsing the HTML and CSS and displaying the
parsed content on the screen.
65. • Networking - used for network calls, like HTTP
requests. It has platform independent interface and
underneath implementations for each platform.
• UI backend - used for drawing basic widgets like combo
boxes and windows. It exposes a generic interface that
is not platform specific. Underneath it uses the
operating system user interface methods.
• JavaScript interpreter. Used to parse and execute the
JavaScript code.
• Data storage. This is a persistence layer. The browser
needs to save all sorts of data on the hard disk, for
examples, cookies. The new HTML specification
(HTML5) defines 'web database' which is a complete
(although light) database in the browser.