Week_10_Web site promotion

Download Report

Transcript Week_10_Web site promotion

Enhance the functionality of a
Web page
• Key points
– Server-Client Interaction
– Forms
– Invoke a CGI script
– Pass parameters to a CGI script
– Client side scripts
Server-Client Interaction
1.
2.
Server push -- the server sends down a chunk of data;
the browser display the data but leaves the connection
open; whenever the server wants it sends more data
and the browser displays it, leaving the connection
open; at some later time the server sends down yet
more data and the browser displays it; etc.
Client pull -- the server sends down a chunk of data,
including a directive (in the HTTP response or the
document header) that says "reload this data in 5
seconds", or "go load this other URL in 10 seconds".
After the specified amount of time has elapsed, the
client does what it was told -- either reloading the
current data or getting new data.
Client pull
• <META HTTP• <META HTTPEQUIV="Refresh"
EQUIV="Refresh"
CONTENT=1>
CONTENT="12;
URL=http://foo.bar/bla
• <title>Document
tz.html">
ONE</title>
• <h1>This is
Document ONE!</h1>
• Here's some text. <p>
Client Pull
• Server sends data + including a directive
• ("reload in X seconds", or "go get Y in X
seconds")
• Client wait then do as told
• Example 2: Switching between two
windows
Server Push
•
•
•
Following in the tradition of the standard
"multipart/mixed", "multipart/x-mixed-replace"
•
messages are composed using a unique
boundary line that separates each data
object. Each data object has its own headers,
allowing for an object-specific content type
and other information to be specified.
The specific behavior of "multipart/x-mixed- •
replace" is that each new data object
replaces the previous data object. The
browser gets rid of the first data object and •
instead displays the second data object.
A "multipart/x-mixed-replace" message
doesn't have to end! That is, the server can
just keep the connection open forever and
send down as many new data objects as it
wants. The process will then terminate if the
user is no longer displaying that data stream
in a browser window or if the browser severs
the connection (e.g. the user presses the
"Stop" button). We expect this will be the
typical way people will use server push.
The previous document will be cleared and
the browser will begin displaying the next
document when the "Content-type" header
is found, or at the end of the headers
otherwise, for a new data block.
The current data block (document) is
considered finished when the next message
boundary is found.
Together, the above two items mean that
the server should push down the pipe: a set
of headers (most likely including "Contenttype"), the data itself, and a separator
(message boundary). When the browser
sees the separator, it knows to sit still and
wait indefinitely for the next data block to
arrive.
Server Push
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
#!/bin/sh
echo "HTTP/1.0 200"
echo "Content-type: multipart/x-mixed-replace;boundary=---ThisRandomString---"
echo ""
echo "---ThisRandomString---"
while true
do
echo "Content-type: text/html"
echo ""
echo "<h2>Processes on this machine updated every 5 seconds</h2>"
echo "time: "
date
echo "<p>"
echo "<plaintext>"
ps -el
echo "---ThisRandomString---"
sleep 5
done
Server push
•
•
•
•
•
•
Server sends data; browser display data
keep connection open;
server wants more data, browser displays
leaving the connection open; …
Example: Stock broker’s terminal
More efficient, bandwidth hungary,
adapted to individual
Forms
•
•
•
•
•
•
•
•
One of the fundamental elements of interaction
Use: sending data to sever for processing
Syntax
<form action=script_url method=get (or
post)>
<input type=xxx name1=yyy value1=zzz>
…
<input type=submit name=submit>
</form>
Pass parameters to a CGI script
• Syntax
• Script_url?name1=value1&name2=valu
e2…
•
• Role of Scripts
• Major: forms, popups
• Minor: counter, clock, etc.
Web site promotion
• Web site promotion or SEO (Search Engine Optimisation)
or web-positioning, although it has many names, its
objective remains the same - improve your position on
search results to get a huge source of traffic without
spending large sums of vital capital in advertising
expenses.
• Key points for this topic
–
–
–
–
–
–
Search engines and directories
Site and page submission
Page optimization
Doorway and hallway pages
Beyond Web site
Rank pushing service and software
Search engines and directories
• Search engine is a software system that collects
and indexes Web pages and respond to queries
with organized results.
• Top three search engines:
– Google http://www.google.com
– Yahoo http://www.yahoo.com
– Ask Jeeves http://www.askjeeves.com
• Directory is a system that collects Web sites and
organizes them in a hierarchical structure. e.g.
Yahoo
Site and page submission
• Submission to a directory
– The following sentence is what I copied from
a company’s homepage: The problem is that
getting there and staying there can be too
expensive for many businesses, especially if
you hire an optimization professional. That's
why we created Submit It! -- to give you the
tools you need to succeed without breaking
the bank.
• Submission to a search engine
Avoid Spamming Searches
•
Avoid spamming searches
– For years experts in the field of Search Engine Optimization (SEO) have
attempted to determine how search engines examine, analyze and rank
web pages. These experts spend incredible amounts of time experimenting,
examining, observing and reverse engineering the algorithms used by
search engines in order to get their (and their clients) pages to rank higher
for desirable keywords and phrases.
– Some of the techniques they use include:
– Domain Name Spamming - A domain name can tell a spider a lot about a
site, and creating thousands of them can say even more.
– Guestbook Spamming - To fool some search engines into thinking there
are a lot of links to a site, some unethical webmasters run special
programs which create entries in thousands or even millions of
guestbooks.
– Keyword stuffing - Spiders look for the number of occurrences of
keywords and phrases on a page to determine the subject (or subjects) of
the information. Spammers can skew the results by including keywords in
various places.
– Log File Spamming - It's possible to take advantage of publicly available
web site statistics to create the illusion of links to a site.
Page optimization
• Keywords selection
– Specific, targeted
• Keywords in meta tags
• Keywords frequency
– Avoid keyword spamming
• Keywords location (url, title, top, bottom,
middle, url, alt)
• Page length
Keywords in meta tags
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>Internet and WWW How to Program Welcome</title>
<!-- <meta> tags provide search engines with -->
<!-- information used to catalog a site
-->
<meta name = "keywords" content = "Web page,
design,
XHTML, tutorial, personal, help, index, form, contact,
feedback, list, links, frame, deitel" />
Demonstrate a
“keywords” meta
element. The
contents attribute of
such a meta
element provides
search engines with
a list of words that
describe a page
<meta name = "description" content = "This Web site
will help you learn the basics of XHTML and Web
page design through the use of interactive examples
and instruction." />
</head>
Demonstrate a “description” meta element. The content attribute of
such a meta element provides a three- to four-line description of a
site, written in sentence form. Search engines also use this
description to catalogue your site and sometimes display this
information as part of the search results.
Doorway and hallway pages
• Functions: Optimized pages (for search engines) leading to
home page.
• Doorway pages, also called gateway pages or hook pages, are
no more than any page of a site which has keywords that may be
found in a search. By entering your site from a search engine at
such a page, visitors experience the page as a 'doorway' to your
web site.
• A hallway page is like an index of urls that you want a search
engine to spider. It has the primary function of acting as an list
of all the pages you want a spider to 'crawl' and index for you.
The reason we use hallway pages, is that many search engines
have a limit upon how many direct submissions you make within
a set time period (sometimes just 1 page per day). By submitting
a hallway page, you are indirectly submitting every page that is
listed on it.
• Advantages:
– do not affect existing design
– compliment to dynamic sites
– individually tuned for unique keyword
Beyond your own Web site
•
•
•
•
•
•
Search engine updating
Keyword ranking
Link popularity
Advertising
Online: email, banners, links
Offline: magazines, newspaper
Rank pushing service and
software
• http://www.webposition.com