"Crazy JavaScript handouts" - skimming

  Three years ago when I learn Java University because of contact with a frenzied lecture series of books, I feel pretty good, so then bought a "mad JavaScript Lecture" book knowledge to learn the front, then some simple front-end is the knowledge from this book learned. All labels and describes the most commonly used selectors and attributes of HTML5 CSS3, and also as a tool for completion of the book review; also introduced the basic content JavaScript programming, with examples to explain the development of "Tetris", although there are CD-ROM, but at that time self when not in use.

  Overall for entry front end, the front end need to know basis can also be read. Because now engaged in testing, so it is not so need this book, give it away before, and read a bit basic content JavaScript programming supplement to learn about.

  1, JavaScript Introduction: embedded interpreted language web page, without compiling, interpreted by the browser execution, dynamically modify HTML content.

  2, DOM Introduction to Programming: Document Object Model (Document Object Model, referred to as DOM), W3C standards developed interface specification is a standard API HTML processing and XML files. DOM provides a way to access the structured documents, but DOM is not a technology, but a thought access structured documents. Based on this idea, every language has its own DOM parser. After the HTML document is parsed into a DOM tree, dynamic HTML content by changing the DOM model.

  3, the local storage offline applications: offline application can explicitly control the browser which resource cache, so that even if the browser is offline, can still use this application; now includes a local storage support web storage when the browser is when offline, unable to submit data to a remote server, data storage can store local user-submitted locally, when the next browser once connected to the Internet, the program can be submitted to centralize data stored locally to the remote server.

① storing small amounts of data; cookie: 4KB size limit; comprising transmitting to the server in each HTTP request, will inevitably lead to repeatedly transmitted; transmission network is not encrypted (unless the entire applications using the SSL), there may be a security risk.

②Session Storage to save user data lifespan Session same period, the end user Session, Session Storage saved data will be lost.

③Local Storage: stored in a user's disk's web storage. Save cycle is very long, unless the user or program to explicitly remove these data, otherwise it will always exist.

  4, data storage structure: In addition to simple string, but also more complex data need to be stored. Data storage structure of the steps of:

  ① the structured data objects packaged as JSON

  ② After the JSON object into a string stored

  When reading data:

  ① reading JSON format string

  ② The JSON format is converted into a string JSON object

  ③ data extracted by the object attribute JSON

  5, applied to the difference between the offline browser cache

  ① different services: offline application cache control the entire Web application. Offline applications is an online web service does not function; but only browser simply cached pages.

  ② different Reliability: off-line applications can precisely control the browser what to cache resources, be reliable; but the browser cache entirely dependent on browser behavior, there is no reliability.

  ③ controllability different: offline application cache which can accurately control the resources, and can control the cache is flushed; but the browser cache dependency browser behavior, can not control the cache behavior.

  6, worker create multi-threaded

  Usage ①worker sub-thread of simple, convenient, developers simply pass a URL JavaScript scripts, create a Worker object, the browser will start a thread to execute this JavaScript script.

  There ② use Worker is created when multiple threads execute a limit, Worker start multithreaded allowed to use DOM API, in other words, Worker start multithreading can not update the front desk HTML page.

  ③ after the current station JavaScript script launched two worker threads between the two Worker threads and can not directly exchange data, need to exchange data that they can only pass the front desk of the JavaScript script to achieve the exchange.

  7, client communications

  WebSocket is a revolutionary technology for real-time applications demand high, by webSocket allows server actively push data to the browser, without the need for browser sends a request to the server.

  ① Option One: periodically sending a request: Request frequent way to stay connected, but will bring a lot of fearless transmission, real time is a very inefficient program.

  ② Option II: The Hidden Connections: Hide Window and server to establish a long connection. This mechanism in the case of concurrent large, it will increase the burden on the service side.

  8, cross-document communication to solve communication problems in different windows HTML document. postMessage (), onmessage ().

 

Guess you like

Origin www.cnblogs.com/cyanlee/p/11907692.html