Skip to content

Web-API #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions JavaScript/Advance/Web API/Intro/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Web-API-Inro</title>
<link rel="shortcut icon" href="images/js-logo.png" type="image/x-icon">
</head>

<body>
<h1>Web API Intoduction</h1>
<p id="textOne"></p>
<button onclick="DisplayOne()">Click to View Doc</button>
<h2>Example</h2>
<button onclick="getLocation()">Get Location</button>
<p id="textTwo"></p>
<script src="script.js"></script>
</body>

</html>
33 changes: 33 additions & 0 deletions JavaScript/Advance/Web API/Intro/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Mention All the Documents and Info about Web API's
let textOne = document.getElementById('textOne');

function DisplayOne() {
textOne.innerHTML = `
<h3>A Web API is a developer's dream.</h3>
<li>It can extend the functionality of the browser</li>
<li>It can greatly simplify complex functions</li>
<li>It can provide easy syntax to complex code</li>
<h1>What is Web API?</h1>
<p>API stands for Application Programming Interface.</p>
<p>A Web API is an application programming interface for the Web.</p>
<p>A Browser API can extend the functionality of a web browser.</p>
<p>A Server API can extend the functionality of a web server.</p>
`
}


// Example For Understanding Web API

let textTwo = document.getElementById('textTwo');

function getLocation() {
try {
navigator.geolocation.getCurrentPosition(showLocation);
} catch {
textTwo.innerHTML = "Error Just Happened";
}
}

function showLocation(position) {
textTwo.innerHTML = "Latitude= " + position.coords.latitude + "<br> Longitude= " + position.coords.longitude;
}