The World Wide Web (WWW) is a system of interconnected hypertext documents accessed through the internet. Uniform Resource Locators (URLs) are used to identify resources on the internet. HTML, XML, JSON, RSS, and JSONP are different data formats used for exchanging information over the internet. HTML is primarily used for web pages, while XML is more flexible and used for data exchange. JSON is commonly used for data transfer between a server and a web application, while RSS is a web feed format used to publish frequently updated content. JSONP is a method for cross-domain AJAX requests. The Hypertext Transfer Protocol (HTTP) is used to transfer data over the internet between web clients and servers. HTTP requests are used by clients to request resources from a server, while HTTP responses are used by servers to send requested resources back to clients. AJAX requests are asynchronous HTTP requests used to dynamically update web pages without requiring a full page refresh. The Same-Origin Policy is a security measure that prevents web pages from accessing resources on a different domain. Workarounds for the Same-Origin Policy include using JSONP or cross-origin resource sharing (CORS). Web Developer Tools are software applications used by developers to debug and optimize web applications.
Topics covered:
WWW and URL
HTML, XML, JSON, RSS, JSONP
The HTTP Protocol
HTTP Request
HTTP Response
AJAX Requests
Same-Origin Policy
Workarounds
JSONP
Web Developer Tools
Video (in Bulgarian)
Presentation Content
What is WWW?
WWW = World Wide Web = Web
Global distributed information system in Internet
A service in Internet (like E-mail, DNS, ...)
Consists of set of documents (and other resources) located on different Internet servers
Accessed through standard protocols like HTTP, HTTPS and FTP by their URL
Web servers provide Web content
Web browsers display the Web content
WWW Components
Structural components
Internet – provides data transfer channels over the TCP and HTTP protocols
Clients (Web browsers) – display Web content
Web servers – IIS, Apache, Tomcat, GWS, etc.
Semantic components
Hyper Text Transfer Protocol ( HTTP )
Hyper Text Markup Language ( HTML )
Uniform Resource Locator ( URL )
Uniform Resource Identifiers ( URIs )
WWW Infrastructure
Clients use Web browser application to request resources from the Web servers via HTTP
Resources have unique URL address
Servers send the requested resource as a response
Or reply with an error message
Web pages are resources in WWW
HTML text, graphics, animations and other files
Web sites
Web sites are sets of Web pages in WWW
Client’s browser renders Web pages returned by the Web servers
Pages are in HTML (Hyper Text Markup Language)
Browsers shows the text, graphics, sounds, etc.
HTML pages contain hyperlinks to other pages
The entire WWW system runs over standard networking protocols
TCP, DNS, HTTP, FTP, …
The HTTP protocol is fundamental for WWW
URL
Uniform Resource Locator (URL)
Unique resource location in WWW, e.g.
It is just a formatted string, consisting of:
Protocol for communicating with the server (e.g., http , ftp , https , ...)
“Only alphanumeric [0-9a-zA-Z], the special characters $-_.+!*’() and reserved characters used for their reserved purposes may be used unencoded within an URL.”
All other characters are escaped with the formula:
%[character hex code in ISO-Latin character set]
Example: space has decimal code 32, in hex – 20, so space in URL becomes %20
Space can also be encoded as " + "
HTML
H yper T ext M arkup L anguage ( HTML )
Notation for describing formatted text with images and hyperlinks
Interpreted and displayed by the Web browsers
A Web ( HTML ) page consists of:
HTML file
CSS stylesheet file (optional)
A bunch of images (optional)
Other resources (optional)
HTML is straight-forward and easy to learn
HTML documents are plain text files
Easy to add formatting, hyperlinks, bullets, etc.
Images can be added as separate files
Can be automatically generated by authoring programs
Tools to help users creating HTML pages
E.g. FrontPage, Dreamweaver, Visual Studio
WYSIWYG HTML editors
HTML – Example
<html><head><title>HTML Example</title></head><body><h3>Heading 1</h3><h2>Sub heading 2</h2><h3>Sub heading 3</h3><p>This is my first paragraph</p><p>This is my second paragraph</p><divalign="center"style="background:skyblue">
This is a div</div></body></html>
XML
XML is markup-language for encoding documents in machine-readable form
Family of Web feed formats for publishing frequently updated works
E.g. blog entries, news headlines, videos, etc.
Based on XML, with standardized XSD schema
RSS documents (feeds) are list of items
Each containing title, author, publish date, summarized text, and metadata
Atom protocol aimed to enhance / replace RSS
RSS – Example
<?xml version="1.0" encoding="utf-8" ?><rssversion="2.0"><channel><title>W3Schools Home Page</title><link>http://www.w3schools.com</link><description>Free web building tutorials</description><item><title>RSS Tutorial</title><link>http://www.w3schools.com/rss</link><description>New RSS tutorial on W3Schools</description></item><item><title>XML Tutorial</title><link>http://www.w3schools.com/xml</link><description>New XML tutorial on W3Schools</description></item></channel></rss>
JSON
JSON (JavaScript Object Notation)
Standard for representing simple data structures and associative arrays
HTTP/1.1 404 Not Found
Date: Fri, 17 Jul 2010 16:09:18 GMT+2
Server: Apache/2.2.14 (Linux)
Connection: close
Content-Type: text/html
<CRLF>
<HTML><HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD><BODY>
<h3>Not Found</h3>
The requested URL /img/telerik-logo.gif was not found on this server.<P>
<HR><ADDRESS>Apache/2.2.14 Server at Port 80</ADDRESS>
</BODY></HTML>
Content-Type and Disposition
The Content-Type header at the server specifies how the output should be processed
Examples:
UTF-8 encoded HTML page. Will be shown in the browser Content-Type: text/html; charset=utf-8
This will download a PDF file named Financial-Report-April-2010.pdf