Hi
I am having a bit of a problem with some JavaScript and PHP. The script (below) works exactly as wanted, but if I run it with the latest version of IE, the JavaScript appears to be looping and it makes the link flash, and it can only be stopped by closing the IE browser. I Firefox, it's probably doing the same, but without any flashing.
What I would like is a means of detecting that the JavaScript has already been run, and therefore shouldn't be run again.
<head>
<script>
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
var lat = position.coords.latitude
var lon = position.coords.longitude
document.location = "prayer-times.php?latitude=" + lat + "&longitude=" + lon
});
}
</script>
<?php
error_reporting(0);
$lat = $_GET['latitude'];
$lon = $_GET['longitude'];
echo "Latitude: " . $lat . "<br/>";
echo "Longitude: " . $lon . "<br/>";
?>
I'm really hoping that there is a DaniWeb expert out somewhere who can offer a solution?
Thanks
Terry