I am trying to implement a simple weather application in codefen. The application works fine on localhost. It requests permission to use navigator.geolocation, and if it is accepted, it shows the weather, but it did not even ask for permission on codepen.
here's a link
http://codepen.io/asamolion/pen/BzWLVe
Here is the JS function
function getWeather() { 'use strict'; $('#getWeatherButton').hide(); if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function (position) { var url = 'http://api.openweathermap.org/data/2.5/weather?APPID=53ac88144e6ee627ad0ed85277545ff9'; // var url = 'example.js'; var apiCall = url + '&lat=' + position.coords.latitude + '&lon=' + position.coords.longitude; // window.location.href = apiCall; $.getJSON(apiCall, function (json) { setSkycon(parseInt(json.weather[0].id, 10)); $('#location').html(json.name + ', ' + json.sys.country); var temp = (Math.round((json.main.temp - 273.15) * 100) / 100); $('#temp').html(temp + '<span id="degree">°</span><span id="FC" onclick="convert()">C</span>'); $('#condition').html(json.weather[0].main); }); }); } };
Can someone tell me why codepen is not asking for permission?
source share