HTTP learning notes

HTTP learning notes

HTTP Fundamentals

Common request methods of HTTP protocol

methodDescription
GETRequest the specified page information and return the response content
POSTSubmit data to the specified resources for processing requests (such as submitting forms or uploading files), and the data is included in the request body. POST requests may lead to the establishment of new resources or the modification of existing resources. For example: login page
HEADIt is similar to the GET request, but there is no specific content in the returned response, which is used to obtain the message header information
PUTThe data transferred from the client server replaces the specified document content
DELETERequests the server to delete the specified page
OPTIONSAllow clients to view server performance

HTTP status code and its meaning

codemeaning
1**Message, request received, continue processing
2**Successful behavior is successfully accepted, understood and adopted
3**Redirection, an action that must be performed further in order to complete the request
4**Client error, request contains syntax error or request cannot be implemented
5**Server error, the server cannot implement an apparently invalid request

For example, 200 indicates that the request is successfully completed, and 404 indicates that the server cannot find the given resource

HTML language

Basic tags for HTML

1. File start label
<html>
  Full contents of the document
</html>
2. File header label
<head>
  
</head>
3. Document title label
<head>
  <title>hello, world</title>
</head>
4. Meta information label
# The information provided by the meta tag is invisible to the user. It is not displayed in the page. It is used to define the name, keyword, author, etc. in the page information< The meta > tag does not need to set an end tag. There are two attributes: name and HTTP equiv. The name attribute is mainly used to describe Web pages for search engine robots to find and classify.
# As the name suggests, http equiv is equivalent to the file header of http. It can send back some useful information to the browser to help correctly and accurately display the web content. The corresponding attribute value is content. The content in content is actually the variable value of each parameter.
Expires   Pragma   Refresh  Set-Cookie   Window-target   content-type
meat Tagged http-equiv The attribute syntax format is:<meta http-equiv="parameter" content="Parameter variable value"> ;among http-equiv Attribute 1. There are the following parameters:
     A,Expires(term)
     Description: it can be used to set the expiration time of web pages. Once the web page expires, it must be retransmitted to the server.
     Usage:<meta http-equiv="expires" content="Fri, 12 Jan 2001 18:18:18 GMT">
     Note: must be used GMT Time format.
     B,Pragma(cache pattern)
     Description: prevents the browser from accessing page content from the cache of the local computer.
     Usage:<meta http-equiv="Pragma" content="no-cache">
     Note: with this setting, visitors will not be able to browse offline.
     C,Refresh(Refresh)
     Description: automatically refresh and point to a new page.
     Usage:<meta http-equiv="Refresh" content="2;URL=http://www.webjx.com">
    Note: 2 refers to the automatic refresh to after 2 seconds URL website.
     D,Set-Cookie(cookie set up)
    Note: if the web page is expired, it will be saved cookie Will be deleted.
     Usage:<meta http-equiv="Set-Cookie" content="cookievalue=xxx; expires=Friday, 12-Jan-2001 18:18:18 GMT; path=/">
     Note: must be used GMT Time format.
     E,Window-target(Display window settings)
     Description: force the page to be displayed as a separate page in the current window.
     Usage:<meta http-equiv="Window-target" content="_top">
     Note: it is used to prevent others from calling their own page in the framework.
     F,content-Type(Display character set settings)
     Description: set the character set used by the page.
     Usage:<meta http-equiv="content-Type" content="text/html; charset=gb2312">

  II meta Function of label
     Above we introduced meta Some basic components of the label, and then let's take a look at it together meta Common functions of labels:
    1,The help home page is logged in by major search engines
     meta A very important function of the tag is to set keywords to help your home page log in by major search engines and improve the traffic of the website. In this function, the most important thing is to Keywords and description Settings for. Because according to the working principle of search engine,The search engine first sends a robot to automatically retrieve the information in the page keywords and decription,And add it to their own database, and then sort the websites according to the density of keywords. Therefore, we must set keywords to improve the search click through rate of the page. Here is an example for your reference:
<meta name="keywords" content="Webpage,Web page making, Web effects,Site construction guide, Tutorial Download, Animation production, web teaching, web materials, video tutorials, technical forums, free space, free domain names">
<meta name="description" content="Web Teaching Network Professional web teaching website">
    After setting these keywords, the search engine will automatically add these keywords to the database and sort them appropriately according to the density of these keywords.
  2,Define the language of the page
  This is meta The most common features of tags,When making web pages,We're in pure HTML You'll see it under the code,It defines the language of your web page,When visitors visit your web page,The browser automatically recognizes and sets the language in the web page,If your web page is set to GB code,The browser is not installed GB code,At this time, the web page will only present the browser default language set by the browser. alike,If the page is in English,that charset=en. The following is a representative example:
  <meta http-equiv=″content-Type″ content=″text/html; charset=gb2312″〉
This code means that the language of the web page is set to the national standard code.
3,Automatically refresh and point to a new page
  If you want to make your web page automatically visit the specified web page within the specified time without control, you can use it meta Tag's function of automatically refreshing web pages. Let's look at a code:
  〈meta http-equiv=″refresh″ content=″2; URL=http://www.webjx.com″〉
  This code can make a current web page automatically go to after 2 seconds http://www.webjx.com page, which is the refresh function of meta. In content, 2 represents the set time (in seconds), and URL is the web page address automatically connected after the specified time.
  4,Realize the animation effect of web page conversion
  use meta Tag, we can also realize the animation effect at the moment of entering or leaving the web page, as long as we html In code<head></head>Add the following code between the tags:
<meta http-equiv="Page-Enter" content="revealTrans(duration=5.0, transition=20)">
<meta http-equiv="Page-Exit" content="revealTrans(duration=5.0, transition=20)">
Once the above code is added to a web page, we will see some special effects when we go in and out of the page. This function is actually similar to FrontPage2000 Medium Format/Page Transition The same, but we should note that the added page cannot be one Frame page;
  5,Web page rating evaluation
  IE4.0 The above version of the browser can prevent browsing some restricted websites,The reason why the browser will automatically identify whether some websites are restricted,Because on the website meta The level of the site has been set in the tag,This level is assessed by the United States RSAC,That is, rated by the rating agency of the entertainment Commission,If you need to evaluate your website,Can connect to website http://www.rsac.org /, submit the form as required, then RSAC will provide you with a meta code and copy it to your own web page. Here is an example of a code:
 〈meta http-equiv=″PICS-Label″
 content=′(PICS-1.1 ″http://www.rsac.org/ratingsv01.html″
 l gen true comment ″RSACi North America Server″
 for ″http://www.rsac.org″
 on ″2001.08.16T08:15-0500″
 r (n 0 s 0 v 0 l 0))′〉
  6,Control page buffering
  meta Tag to set the expiration time of the web page,in other words,When you are Internet Explorer When browsing a web page in the browser, first view the page in the local buffer,So when browsing a web page,And local buffering sometimes,Then the browser will automatically browse the pages in the buffer,until meta The time set in expires,At this time,The browser will get the new page. For example, the following code indicates that the expiration time of the web page is 18:18:18 on January 12, 2001.
  〈meta http-equiv=″expires″ content=″Friday, 12-Jan-2001 18:18:18 GMT″〉
7,Windows that control the display of web pages
  We can also use meta Tag to control the window displayed on the web page. Just add the following code to the web page:<metahttp-equiv="window-target" content="_top">,This code can prevent the web page from being used as a Frame Call.

Article 7 controls the window displayed on the web page. This code can prevent the web page from being called by others as a Frame

5. Body label of the page
AttributesDescription
textSets the color of the page text
bgcolorSets the color of the page background
backgroudSet the background image of the page
bgpropertiesSet the background image of the page as fixed and do not scroll with the page scrolling
linkSets the default link color for the page
alinkSets the link color when the mouse is clicking
vlinkSet link color after access
topmarginSets the top margin of the page
leftmarginSet the left margin of the page

CSS cascading style sheet

CSS overview

CSS is the abbreviation of Cascading Style Sheets. It is a markup language used to define the layout of HTML documents. For example, CSS involves font, color, margin, height, width, background image, advanced positioning, etc.

attribute selectors

The attribute selector selects tags through attributes, which can be either standard attributes (default attributes in HTML) or custom attributes. For example, in an HTML page, multiple are inserted

Label, and for each

The label sets the font size, color, etc., and the code is as follows:

<p font='fontsize'>Programming books</p>
<p color='red'>PHP programming</p>
<p color = 'green'>contemporary literature</p>

After adding attributes to tags in HTML, you can use the attribute selector in CSS to select the corresponding tags to change the style. When using the attribute selector, you need to declare the attribute and attribute value. The declaration method is as follows:

[att=val]{}
att Representative attribute; val Represents the attribute value
# Select all p tags whose color attribute is red and set their font color to red
[color=red]{
color:red;				
}
Select all font The property value of the property is fontsize of p label
[font=fontsize]{
font-size:20px;
}

Class and ID selectors

The ID selector selects the adding style through the ID attribute in the HTML page, which is basically the same as the class selector, but it should be noted that the HTML page cannot contain two identical ID tags. Therefore, the defined ID selector can also be used once. The ID selector is preceded by a '#' sign, checkerboard number or pound sign.

#intro{color:red}

The name of the class selector is defined by the user with '.' At the beginning, you need to apply the HTML tag of the category selector, just use the class attribute to declare it. The syntax is as follows:

.intro{color:red;}

The ID selector refers to the ID attribute value, while the class selector refers to the class attribute value.

Note: the tag class attribute in a web page can define multiple, while the ID attribute can only define one. For example, only one tag ID in a page can have an attribute value of 'intro'

JavaScript dynamic scripting language

In general, the front end refers to three technologies: HTML, CSS and JavaScript:

HTML: defining web page content

CSS: describes the style of a web page

JavaScript: describes the behavior of web pages

There are two ways to use JavaScript in Web pages: one is to directly embed JavaScript code in the page, and the other is to link external JavaScript files. Embed JS code directly in HTML documents

<html>
  <script language=="javascript">alert('stay HTML In, write directly JavaScript code'</script>
</html>
Attribute valueexplain
languageSet the script language and version used by the lock
srcSet the path and location of an external script file
typeSet the script language used. This property has replaced the language property
deferThis attribute indicates that the script language is executed after the HTML document is loaded

***

Connect external JavaScript files

Put the script code in a separate file (extension. js). When you need to use the code, you can link the JavaScript file in the Web page. The syntax format is as follows:

<script language='javascript' src='your-script.js'></script>

In an external JavaScript file, you do not need to label the script code

Keywords: Front-end server http

Added by Eggzorcist on Mon, 24 Jan 2022 22:46:24 +0200