The HTML5 API for those cows.

Source: Internet
Author: User
Tags sessionstorage

Those cattle HTML5 API (ii)

1: Video player

2: geo-positioning

Our support HTML5 browser provides us with an interface (API) that can be used to get your current location.

Mainly through geolocation (geographical location), objects, to access the hardware, to obtain the latitude and longitude.

1  if (navigator.geolocation) {2  navigator.geolocation.getCurrentPosition (showposition); 3  } else{4 X.innerhtml= "Geolocation is not supported by this browser.";} 5  }

What we get is a latitude and longitude. We call the map. We call Baidu Map. (Street View map)

3: Drag
HTML5 inside support drag and drop
1) The currently dragged element
Ondrag is applied to the drag element, the entire drag process is called
The ondragstart is applied to the drag element, which is invoked when the drag is started.
The OnDragLeave is applied to the drag element, which is called when the mouse leaves the dragged element.
The ondragend is applied to the drag element, which is called when the drag is finished.
2) Target Element
The ondragenter is applied to the target element and is called when the drag element enters
The ondragover is applied to the target element and is called when it stays on the target element.
The OnDrop is applied to the target element and is invoked when the mouse is released on the target element.
The OnDragLeave is applied to the target element and is called when the mouse leaves the target element

4:web Storage
We can save the data locally by Sessionstorage and Localstorage objects.

1 SetItem (Key,value) 2 GetItem (); 3 RemoveItem (); 4 clear ();

These four methods are demonstrated through this object sessionstorage. (The design to the data operation is to delete and change the search.)
Localstorage saving data; the same way.
The difference between Sessionstorage and localstorage
①localstorage data is permanently saved
②sessionstorage close the browser and there's no

5: App level cache (cache file, Css,js picture.)
We create a new HTML file and then I want to make a cache for this HTML file
First step, I want to create a new Demo.appcache
Then refer to this Demo.appcache file in HTML
Manifest= "Demo.appcache"
Then we want to specify the cached data, which is specified in the Demo.appcache cache file.

First line:
CACHE MANIFEST
I need to specify that those files need to be cached
CACHE:
The path of the file that needs to be cached
NETWORK:
Those files need to be accessed by the network.

The HTML5 API for those cows.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.