Session 15: Grab Bag
Harvard Extension School
Fall 2020
Course Web Site: https://cscie12.dce.harvard.edu/
Topics
- Wrapping Up
- Search Engines and Optimization
- Most Relevant JavaScript Functions for a Webpage
- HTTP Cookies
- HTML5 Microdata (part of Semantic Web)
- Accessibility
- Oh, The Places You'll Go!
Presentation contains 16 slides
Wrapping Up
- December 15, Final Project due at 6pm
- December 15, Class Meeting Time, Optional Presentations of Final Projects
- When does access stop?
Search Engines and Optimization
- Prepare
- Content: Valid markup (or at least well-formed!), semantic markup,
<title>
, meta tags, visual elements have text - Site: robots.txt, sitemap.xml
- Content: Valid markup (or at least well-formed!), semantic markup,
- Submit your site
Content: meta tags
meta tags and Metadata Guidelines (W3 EOWG)
meta elements from Harvard University:
<meta property="twitter:account_id" content="1491443782" />
<meta name="twitter:site" content="@harvard">
<meta name="twitter:creator" content="@harvard">
<meta name="twitter:card" content="summary_large_image">
<meta property="og:site_name" content="Harvard University"/>
<meta property="og:type" content="university"/>
<meta property="og:title" content="Harvard University"/>
<meta property="og:url"
content="https://www.harvard.edu"/>
<meta property="og:description" content="Harvard University is devoted to excellence in
teaching, learning, and research, and to developing leaders
in many disciplines who make a difference globally.
Harvard University is made up of 11 principal academic units."/>
<meta property="og:image"
content="https://www.harvard.edu/sites/default/files/default_images/harvard-social1200.jpg"/>
Search Robots, Crawlers, Spiders
Three mechanisms to instruct robots that visit your site:
- robots.txt file
- robots meta tag
rel="nofollow"
fora
elements
robots.txt and Examples
- User-Agent
- Disallow
Check out some real robots.txt files!
Robots meta element in markup
<meta name="robots" content="noindex,nofollow" />
- name="robots"
- content
- index or noindex
- follow or nofollow
- noarchive
- none
- all
The Robots meta element can be used on a per document basis.
HTTP Header: X-Robots-Tag
index
— index the pagenoindex
— don't index the pagefollow
— follow links from the pagenosnippet
— don't display descriptions or cached linksnofollow
— don't follow links from the pagenoarchive
— don't cache/archive the pagenone
— do nothing, ignore the pageall
— do whatever you want, default behavior
Most Relevant JavaScript Functions for a Webpage
- Traversing the DOM, including "form" elements
- Manipulating the DOM
- Manipulating CSS properties
- GET / POST back to server
HTTP Cookies
- Server "sets" cookies
- Browser "returns" cookies
Cookie Example
- Server returns cookie to HTTP client ("Set-Cookie" response header)
- HTTP client returns cookie to server ("Cookie" request header)
ESPN Cookies
set-cookie: edition=espn-en-us; path=/; Expires=Thu, 30 Jul 2020 20:18:00 GMT;
set-cookie: edition-view=espn-en-us; path=/; Expires=Thu, 30 Jul 2020 20:18:00 GMT;
set-cookie: connectionspeed=full; path=/; Expires=Thu, 30 Jul 2020 20:18:00 GMT;
set-cookie: country=us; path=/;
set-cookie: region=unknown; path=/; Expires=Thu, 30 Jul 2020 20:18:00 GMT;
set-cookie: _dcf=1; path=/; Expires=Thu, 30 Jul 2020 20:18:00 GMT;
set-cookie: SWID=13DEEEC4-564E-4A9A-CA91-D6978548D894; path=/; Expires=Mon, 23 Jul 2040 20:18:00 GMT; domain=espn.com;
Your Cookies
- Firefox: about:preferences#privacy
- Chrome: chrome://settings/siteData?search=cookies
- Edge: Settings and more → Settings → Site permissions
- Safari: Preferences → Privacy
Firefox Cookies
Chrome - Cookies
Cookies and Session IDs
A UserID or SessionID (a long character/number string that is uniquely assigned) is often stored in cookie. The SessionID is used as the key or identifier when storing information about the user or session.
For example, a user logs in to a site. If the username and password match, the server sets a cookie ("Set-Cookie") in the browser that contains a session id; the server also makes an entry in website database that maps the session id to the username. When the cookie is returned, the session id is read and the username is looked up in the database.
HTML5 Microdata (part of Semantic Web)
In addition to the classic "Web of documents" W3C is helping to build a technology stack to support a “Web of data,” the sort of data you find in databases. The ultimate goal of the Web of data is to enable computers to do more useful work and to develop systems that can support trusted interactions over the network. The term “Semantic Web” refers to W3C’s vision of the Web of linked data. Semantic Web technologies enable people to create data stores on the Web, build vocabularies, and write rules for handling data. Linked data are empowered by technologies such as RDF, SPARQL, OWL, and SKOS.
- Linked Data
- Vocabularies
- Query
- Inference
- Vertical Applications
Semantic Web Content
- RDFa (rdfa.info)
- Microformats (microformats.org)
- HTML5 Microdata (MDN Microdata)
HTML5: microdata
Vocabularies for:
- People
- Organizations
- Events
- Reviews
See schema.org for more informatino about vocabularies
Microdata Example
<div itemscope="" itemtype="https://schema.org/WebPage">
<h1 itemprop="name">Lecture 12: Graphs, networks, incidence matrices</h1>
<p itemprop="description">These video lectures of Professor Gilbert
Strang teaching 18.06 were recorded in Fall 1999 and do not
correspond precisely to the current edition of the textbook.</p>
<div itemprop="publisher" itemscope="" itemtype="https://schema.org/CollegeOrUniversity">
<h4 class="footer">About <span itemprop="name">MIT OpenCourseWare</span></h4>
</div>
<a itemprop="license"
rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/deed.en_US"><img
src="/images/cc_by-nc-sa.png" alt="Creative Commons logo with terms BY-NC-SA." /></a>
</div>
Lecture 12: Graphs, networks, incidence matrices
These video lectures of Professor Gilbert Strang teaching 18.06 were recorded in Fall 1999 and do not correspond precisely to the current edition of the textbook.
About MIT OpenCourseWare

Accessibility
The power of the Web is in its universality.
Access by everyone regardless of disability is an essential aspect.
Tim Berners-Lee, W3C Director and inventor of the World Wide Web
Things to know about:
- W3C WAI and WCAG
Accessibility: Getting Started
Oh, The Places You'll Go!

- Back-end programming (Python, JS)
- Front-end programming (JS, CSS)
- Content and Design
- Computer Science
- CSCI E-3 Introduction to Web Programming with JavaScript
- CSCI E-7 Introduction to Programming with Python
- CSCI E-10A/B Introduction to Computer Science Using Java - I and II
- CSCI E-14A Building Interactive Web Applications for Data Analysis
- Digital Media
- DGMD E-2 Web Programming for Beginners with PHP
- DGMD E-20 Modern and Mobile Front-End Design I
DGMD E-27 Modern and Mobile Front-End Design II - DGMD E-23 Planning Successful Websites and Applications
- DGMD E-26 WordPress Programming
- DGMD E-28 Single-Page Applications and Interfaces with Vue.js