Click here to Skip to main content
14,601,286 members

JavaScript

 
AnswerRe: web development Pin
phil.o4-Nov-19 2:18
mvephil.o4-Nov-19 2:18 
GeneralRe: web development Pin
Richard MacCutchan4-Nov-19 2:26
mveRichard MacCutchan4-Nov-19 2:26 
GeneralRe: web development Pin
phil.o4-Nov-19 2:55
mvephil.o4-Nov-19 2:55 
GeneralRe: web development Pin
F-ES Sitecore4-Nov-19 22:40
mveF-ES Sitecore4-Nov-19 22:40 
AnswerRe: web development Pin
Pete O'Hanlon5-Nov-19 0:03
subeditorPete O'Hanlon5-Nov-19 0:03 
QuestionProblem with Geolocation Pin
Member 146374312-Nov-19 10:48
MemberMember 146374312-Nov-19 10:48 
AnswerRe: Problem with Geolocation Pin
A_Griffin2-Nov-19 11:23
MemberA_Griffin2-Nov-19 11:23 
QuestionProblem with Geolocation Pin
Member 1463743128-Oct-19 13:50
MemberMember 1463743128-Oct-19 13:50 
This is the first time i've posted on this website, so if i'm doing something wrong just let me know. Anyways, I'm having a problem getting my geolocation to work. I absolutely cannot figure out what the problem is. Without the geolocation bit of code, the default location, markers, and such work fine. Then when I try to add in the geolocation the map won't appear at all and just the button appears.

<pre><div id="map"> </div>     
    <script>
    var map;
    function initMap() {
    var myLatLng = {lat: 41.413118, lng: -82.072537}

     map = new google.maps.Map(document.getElementById('map'), {
      center: myLatLng,
      zoom: 18
     });

     var marker = new google.maps.Marker({
     position: myLatLng,
     map: map,
     title: 'My Location'
     });

     var marker = new google.maps.Marker({
     position: {lat: 41.412726, lng: -82.072047},
     map: map,
     title: 'PS Building',
     label: {text:'PS Building'}
     });

     infoWindow = new google.maps.InfoWindow;

     if (navigator.geolocation) {
     navigator.geolocation.getCurrentPosition(function(position) {
     var pos = {
       lat: position.coords.latitude,
       lng: position.coords.longitude
     };
     var marker = new google.maps.Marker({
      position: pos,
      map: map,
      title: 'Your Location'
     });

     infoWindow.setPosition(pos);
     infoWindow.open(map);
     map.setCenter(pos);
     }, function() {
     handleLocationError(true, infoWindow, map.getCenter());
     });
     } else {
     // Browser doesn't support Geolocation
     handleLocationError(false, infoWindow, map.getCenter());
    }
   }

 function handleLocationError(browserHasGeolocation, infoWindow, pos) {
 infoWindow.setPosition(pos);
 infoWindow.setContent(browserHasGeolocation ?
                      'Error: The Geolocation service failed.' :
                       'Error: Your browser doesn\'t support 
 geolocation.');
 infoWindow.open(map);
 }
 }


  </script>
  <script src="https://maps.googleapis.com/maps/api/js?key= 
  AIzaSyCyO4aFysnjiQ9DO5VSDSJ_DtPd6O9mkDI&callback=initMap"
  async defer></script>

  <form>
  <input type="button" onclick="GetLocation();" value="click"/>
  </form>

AnswerRe: Problem with Geolocation Pin
Nathan Minier29-Oct-19 1:31
professionalNathan Minier29-Oct-19 1:31 
GeneralRe: Problem with Geolocation Pin
Richard Deeming29-Oct-19 2:16
mveRichard Deeming29-Oct-19 2:16 
GeneralRe: Problem with Geolocation Pin
Nathan Minier29-Oct-19 2:46
professionalNathan Minier29-Oct-19 2:46 
AnswerRe: Problem with Geolocation Pin
A_Griffin2-Nov-19 8:00
MemberA_Griffin2-Nov-19 8:00 
QuestionOpening an External URL Page in my Modal Dialog and capture some of the information that's being submitted to the parent React Pin
simpledeveloper23-Oct-19 12:29
Membersimpledeveloper23-Oct-19 12:29 
AnswerRe: Opening an External URL Page in my Modal Dialog and capture some of the information that's being submitted to the parent React Pin
jkirkerx24-Oct-19 12:35
professionaljkirkerx24-Oct-19 12:35 
GeneralRe: Opening an External URL Page in my Modal Dialog and capture some of the information that's being submitted to the parent React Pin
simpledeveloper24-Oct-19 13:23
Membersimpledeveloper24-Oct-19 13:23 
QuestionCan ms blazor be next level of client-side coding Pin
simpledeveloper23-Oct-19 11:42
Membersimpledeveloper23-Oct-19 11:42 
AnswerRe: Can ms blazor be next level of client-side coding Pin
jkirkerx24-Oct-19 12:00
professionaljkirkerx24-Oct-19 12:00 
GeneralRe: Can ms blazor be next level of client-side coding Pin
simpledeveloper24-Oct-19 13:22
Membersimpledeveloper24-Oct-19 13:22 
GeneralRe: Can ms blazor be next level of client-side coding Pin
jkirkerx25-Oct-19 10:53
professionaljkirkerx25-Oct-19 10:53 
AnswerRe: Can ms blazor be next level of client-side coding Pin
Pete O'Hanlon5-Nov-19 0:45
subeditorPete O'Hanlon5-Nov-19 0:45 
GeneralRe: Can ms blazor be next level of client-side coding Pin
simpledeveloper5-Nov-19 6:09
Membersimpledeveloper5-Nov-19 6:09 
GeneralRe: Can ms blazor be next level of client-side coding Pin
Pete O'Hanlon5-Nov-19 20:40
subeditorPete O'Hanlon5-Nov-19 20:40 
QuestionOpen base64 encoded pdf file using javascript Pin
Member 1286358021-Oct-19 4:16
MemberMember 1286358021-Oct-19 4:16 
AnswerRe: Open base64 encoded pdf file using javascript Pin
jkirkerx21-Oct-19 12:22
professionaljkirkerx21-Oct-19 12:22 
AnswerRe: Open base64 encoded pdf file using javascript Pin
Richard Deeming22-Oct-19 1:15
mveRichard Deeming22-Oct-19 1:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.