Toggle navigation
Toggle navigation
This project
Loading...
Sign in
강희주
/
Music_Recommendation_Website
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
진재영
2022-05-30 23:27:44 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b783ed6a1f8721eff5b71d49e7327306c3b6e2d4
b783ed6a
1 parent
1b78c086
gps api js file uploaded
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
gps_api/example.html
gps_api/practice.js
gps_api/example.html
0 → 100644
View file @
b783ed6
<!DOCTYPE html>
<html
lang=
"ko"
>
<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>
Geolocation example - getCurrentPosition()
</title>
</head>
<body>
<script
type=
"text/javascript"
src=
"practice.js"
></script>
</body>
</html>
gps_api/practice.js
0 → 100644
View file @
b783ed6
if
(
navigator
.
geolocation
)
{
navigator
.
geolocation
.
getCurrentPosition
(
success
,
error
);
}
else
{
alert
(
"Your browser is not support geolocation."
)
//navigator이 현재 브라우저에서 작동하지 않는 경우
}
function
success
(
position
)
{
var
latitude
=
position
.
coords
.
latitude
;
var
longitude
=
position
.
coords
.
longitude
console
.
log
(
`Your latitude is
${
latitude
}
and your longitude is
${
longitude
}
`
)
// 위도와 경도 값을 console로 알려줌
return
(
latitude
,
longitude
);
}
function
error
()
{
alert
(
"Can't detect your location. Try again later."
)
// error function
}
\ No newline at end of file
Please
register
or
login
to post a comment