Færdiggjort

Javascript - Save Geolocation Coordinates

I would like to save the coordinates in localstorage so that it shouldn't ask the users every time to allow GPS or Location and a button to clear the localstorage value so it can again ask for coordinates?

Also it should work with Android & IOS Mobile View.

FYI: I am using Praytimes JS to display Muslim prayer times but for each location i have to manually add latitude & longitude of that location.

Below is my code:

<script type="text/javascript" src="[login to view URL]"></script>

<script type="text/javascript">

var x = [login to view URL]("currentlocation");

var geocoder;

if ([login to view URL]) {

[login to view URL](successFunction, errorFunction);

}

//Get the latitude and the longitude;

function successFunction(position) {

var lat = [login to view URL];

var lng = [login to view URL];

codeLatLng(lat, lng)

}

function errorFunction(){

$('#currentlocation').html("Geocoder failed");

}

function initialize() {

geocoder = new [login to view URL]();

}

function codeLatLng(lat, lng) {

var latlng = new [login to view URL](lat, lng);

[login to view URL]({'latLng': latlng}, function(results, status) {

if (status == [login to view URL]) {

[login to view URL](results)

if (results[1]) {

//formatted address

$('#currentlocation').html(results[0].formatted_address);

//find country name

for (var i=0; i<results[0].[login to view URL]; i++) {

for (var b=0;b<results[0].address_components[i].[login to view URL];b++) {

//there are different types that might hold a city admin_area_lvl_1 usually does in come cases looking for sublocality type will be more appropriate

if (results[0].address_components[i].types[b] == "administrative_area_level_2") {

//this is the object you are looking for

city= results[0].address_components[i];

break;

}

}

}

//city data

$('#currentlocation').html(city.short_name + " " + city.long_name)

} else {

$('#currentlocation').html("No results found");

}

} else {

$('#currentlocation').html("Geocoder failed due to: " + status);

}

});

}

</script>

<p id="currentlocation"></p>

<script type="text/javascript" src="[login to view URL]"></script>

<script type="text/javascript">

function loadTable(position) {

[login to view URL]('MWL');

var date = new Date(); // today

var times = [login to view URL](date, [[login to view URL], [login to view URL]]);

var list = ['Fajr', 'Sunrise', 'Dhuhr', 'Asr', 'Maghrib', 'Isha', 'Midnight'];

var html = '<table id="timetable">';

html += '<tr><th colspan="2">'+ [login to view URL]()+ '</th></tr>';

for(var i in list) {

html += '<tr><td>'+ list[i]+ '</td>';

html += '<td>'+ times[list[i].toLowerCase()]+ '</td></tr>';

}

html += '</table>';

[login to view URL]('table').innerHTML = html;

}

if ([login to view URL]) {

[login to view URL](loadTable);

}

</script>

Evner: Android, HMLT5, iPhone, Javascript, jQuery / Prototype

Se mere: navigator geolocation, w3c geolocation api, how much to add on printing cost as graphic designer, how do you add money to paypal, how i can save energy creative writing, google maps javascript api geolocation, silverlight save controls coordinates, javascript auto click coordinates, javascript yahoo maps coordinates marker, add runtime input html tag display extjs, php using xml file save database, allow frontend users add products virtuemart, friends myspace add 5000 times day, allow registered users add entry sobi2, javascript calculator clear button

Om arbejdsgiveren:
( 4 bedømmelser ) salmiya, Kuwait

Projekt ID: #17329237

Tildelt til:

zmgroup

I am a Software Engineer having 6 years of extensive hands-on experience in Object Oriented Analysis & Design (OOAD) and Database Design and Implementation using Agile, UML, .NET Framework, C#, ASP.NET, ASP.NET MVC, T Flere

$10 USD in 0 dage
(4 bedømmelser)
3.1

7 freelancere byder i gennemsnit $31 på dette job

$55 USD på 1 dag
(223 bedømmelser)
8.5
amitbanerjee2812

Dear Hiring Manager, We are very passionate developers with 5+ years of experience in iPhone/iPad, Android application development. Our skills in specially Ios, Android, Objective C, C, C++, MySql, Git, Swift, A Flere

$25 USD på 1 dag
(13 bedømmelser)
4.9
$25 USD på 1 dag
(42 bedømmelser)
5.0
rohit554ITHUB

Hello, I have 6+ years experience in PHP, WordPress & Codeigniter. I Read your job description, I'm interesting in your job. we feel that we are suitable for the job. As a senior WordPress expert, I'll be glad Flere

$55 USD på 1 dag
(9 bedømmelser)
3.1
$25 USD på 1 dag
(3 bedømmelser)
1.9
$25 USD på 1 dag
(2 bedømmelser)
0.8