Home Web Front-end H5 Tutorial html5 finishing

html5 finishing

Dec 05, 2016 am 10:57 AM
html5

HTML5新的Input类型 
输入类型:color,data,datetime,datetime-local,email,month,number,range,search,tel,time,url,week 
HTML Web存储 localStorage 
没有时间限制的数据存储 
以键/值对的形式表示 
setItem(),getItem() 
localStorage.name="Smith"; 
sessionStorage 
当用户关闭浏览器窗口时,数据会被删除 
以键/值对的形式表示 
setItem(),getItem() 
sessionStorage.setItem('name','smith'); 
Web SQL数据库(略) 
核心方法: 
openDatabase 使用现有的数据库或新建的数据库创建一个数据库对象 
transaction 这个方法使我们能够控制一个事务,以及基于这种情况执行提交或者回滚 
executeSql 这个方法用于执行实际的SQL查询 
一个完整实例 
 
 
 
 
 
 

状态信息



Copy code
Application cache (omitted)
To enable application cache, please include the manifest attribute in the tag of the document:

< ;html manifest="demo.appcache">
...

Copy code
Manifest file
CACHE MANIFEST - Files listed under this heading will be cached after the first download
NETWORK - here The files listed under this heading require a connection to the server and will not be cached
FALLBACK - The files listed under this heading specify the fallback page when the page is inaccessible (such as a 404 page)
Complete Manifest file example
CACHE MANIFEST
# 2012-02-21 v1.0.0
/theme.css
/logo.gif
/main.js
NETWORK:
login.php
FALLBACK:
/html/ /offline.html
Copy code
Web Workers
Web worker is javascript running in the background, independent of other scripts, and will not affect the performance of the page
function startWorker(){
if(typeof(Worker) != "undefined"){
if(typeof(w) == " undefined"){
w=new Worker('demo_worker.js');
}
w.onmessage=function(event){
document.getElementById('result').innerHTML=event.data;
};
}
}
function stopWorker(){
w.terminate();
w = undefined;
}
Copy code
/*demo_worker.js*/
var i=0;
function timedCount(){
i=i+ 1;
postMessage(i);
setTimeout('timedCount()',500);
}
timedCount();
Copy code
Server-Sent Event (SSE)
Server-Sent event refers to the automatic acquisition of web pages from the server of updates.
WebSocket
WebSocket is a protocol for full-duplex communication on a single TCP connection that HTML5 started to provide.
In the WebSocket API, the browser and the server only need to perform a handshake action, and then a fast channel is formed between the browser and the server. Data can be transmitted directly between the two.
The browser sends a request to the server to establish a WebSocket connection through JavaScript. After the connection is established, the client and server can directly exchange data through the TCP connection.
After you obtain the Web Socket connection, you can send data to the server through the send() method, and receive data returned by the server through the onmessage event.
var Socket = new WebSocket(url, [protocal])
WebSocket properties
Socket.readyState
0 - Indicates that the connection has not yet been established
1 - Indicates that the connection has been established and communication is possible
2 - Indicates that the connection is being closed
3 - Indicates The connection has been closed or the connection cannot be opened
WebSocket event
Socket.onopen - triggered when the connection is established
Socket.onmessage - triggered when the client receives data from the server
Socket.onerror - triggered when a communication error occurs
Socket.onclose - triggered when the connection is closed Trigger
WebSocket method
Socket.send()
Socket.close()

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Table Border in HTML Table Border in HTML Sep 04, 2024 pm 04:49 PM

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

HTML margin-left HTML margin-left Sep 04, 2024 pm 04:48 PM

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

Nested Table in HTML Nested Table in HTML Sep 04, 2024 pm 04:49 PM

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

HTML Table Layout HTML Table Layout Sep 04, 2024 pm 04:54 PM

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

HTML Ordered List HTML Ordered List Sep 04, 2024 pm 04:43 PM

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

HTML Input Placeholder HTML Input Placeholder Sep 04, 2024 pm 04:54 PM

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Moving Text in HTML Moving Text in HTML Sep 04, 2024 pm 04:45 PM

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

HTML onclick Button HTML onclick Button Sep 04, 2024 pm 04:49 PM

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.

See all articles