Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMelissa Kepler
11,369 PointsgetCurrentPosition() and watchPosition() are deprecated according to chorme security.
I just wanted to put it out there in case anyone else runs sees this in their Chrome console while doing this workshop. I had no problems with the code, but I got this warning:
"getCurrentPosition() and watchPosition() are deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details."
Andrew Chalkley, does this mean in the future people doing this workshop will not be able to check their code through their browser?
3 Answers
Andrew Chalkley
Treehouse Guest TeacherAll the code will work but on https
sites. I have no idea what the implications are about running it locally though :/
Adam Fields
Full Stack JavaScript Techdegree Graduate 37,838 PointsFor anyone who wants to follow along, use the NPM package Browser Sync: https://www.npmjs.com/package/browser-sync
Once you have it installed, run browser-sync start --server --https
and you'll have a local HTTPS server.
Many APIs require HTTPS, so I've been using Browser Sync for all my work outside of Treehouse. To get around the Cross Origin Resource Sharing limitation on many APIs, you can add the --cors
flag when running Browser Sync as well.
There are other local dev server programs - I just personally think Browser Sync is the best :)
Daniel Murnane
5,079 PointsDoesn't seem to have been much discussion on this in a while, but I have another option that lets you learn a bit about the Google geolocation along the way! I followed this StackOverflow answer.
Follow the JSfiddle example given in the top answer, and it requires only a little alteration to the Treehouse workspace. The main alterations are:
- Add a "failed" argument to the main function:
js navigator.geolocation.getCurrentPosition(gotLocation,browserGeolocationFail,{maximumAge: 50000, timeout: 20000, enableHighAccuracy: true});
- Copy the chunk inside
gotLocation(){...}
intoapiGeolocationSuccess(){...}
- Fix the position/currentPosition inconsistency between the workspace and the StackOverflow answer
Bingo! It should work.
methany salander
Courses Plus Student 40 Pointsmethany salander
Courses Plus Student 40 PointsYou're right. Your accent take time to understand, but you are a good teacher and i hope more javascript courses made by you.
Mike Gentry
Full Stack JavaScript Techdegree Student 4,296 PointsMike Gentry
Full Stack JavaScript Techdegree Student 4,296 PointsHow is this a helpful response? I am getting the same error too. Looks like the workspace/workshop is broken and needs updating.
Andrew Chalkley
Treehouse Guest TeacherAndrew Chalkley
Treehouse Guest TeacherWhen I click on preview in workspaces, the url is an http:// url. When I change it to https:// it works.
For example, my workspace preview url started as:
http://port-80-x9889ymuhb.treehouse-app.com/
...when I modified the URL to be secure, with
https
in front it now works.https://port-80-x9889ymuhb.treehouse-app.com/
Chrome's policy only allows Geolocation on secure URLs now.