API stands for Application Programming Interface. An API is a set of pre-built programs that can be used with the help of JavaScript. APIs are used to implement already written code to fulfill the needs of the project you are working on.
The Geolocation API is used to get the current location of the user or the page visitor. It will show the user’s location only if the user allows it to do so, as it compromises the security and privacy of the user.
>getCurrentPosition() Method: The getCurrentPosition() method returns an object with properties such as latitude, longitude, accuracy, altitude etc. watchPosition() Method: This method will return the current position of the user as well as the updated location when the position of the user changes or the user travels from one location to another location. clearWatch() Method: This method will stop the watchPosition() method to not tracing the user anymore.
var loc = navigator.geolocation;
HTML Drag and Drop API: Drag and Drop is a common feature nowadays, where you can drag an item from one place and drop it in another.
draggable="true"
Drag image into the container
HTML Web Storage API: HTML web storage API is used to store the data on the web browser.Early, the data was stored in the form of cookies that can store a small amount of data and can-not transferred further to the server. But, HTML5 introduces us to the Web Storage API that can store large data as compared to cookies and can be transferred to the server. Using this API for storing data is more secure than using cookies. Web storage API provides us with two objects to work with: window.sessionStorage: This object temporarily stores the data on the web browser such that if the browser is refreshed or closed the data stored will be lost. window.localStorage: localStorage permanently stores the data on the browser with no expiration such that will not be lost even if the browser is refreshed.
HTML5 File API aspect provides an API for representing file objects in web applications and programmatic selection and accessing their data. In addition, this specification defines objects to be used within threaded web applications for the synchronous reading of files. The File API describes how interactions with files are handled, for reading information about them and their data as well, to be able to upload it.
6C. Which technology provides browsers with
functionality that previously required
users to install proprietary plug-ins?
a. PHP
b. ECMA
c. HTML5 APIs
d. Java applets
8C. Experts in Web technology expect
that the future of Web development
will rely heavily on:
a. Java applets
b. Android mobile devices
c. Apple mobile devices
d. HTML5 APIs
35B.Which of the following is a function
of the HTML5 File API?
a. Create preview thumbnail images during
the image uploads.
b. Locate the position of the client system.
c. Validate HTML5 code.
d. Move files using a drop zone.
38.HTML5 APIs can be used to create:
a. databases on remote servers.
b. scripts that send email messages.
c. apps for mobile devices.
d. embedded and external style sheets.
27. Which HTML5 API could you use to make an
AJAX image gallery easier to navigate?
a. The History API
b. The Drag-and-Drop API
c. The Geolocatin API
d. The File API
function myFunction() {
window.history.back();
}
12.Tadashi is a developer for a company that
manufactures various products and has divisions
throughout the world. He is tasked with creating
a Webpage that will allow team members in
training to drag pictures of company products
to the correct company division that creates each
product. Which HTML5 API can Tadashi use to provide
this functionality?
a. The Geolocation API
b. The File API
c. The Drag-and-Drop API
d. The AppCache API
16.Julian wants to embed videos and animations
in his Website without using a browser plug-in.
Which HTML5 API will enable him to do this?
a. The Geolocation API
b. The Drag-and-Drop API
c. The Canvas API
d. The File API