Friday 27 January 2012

Javascript to request GPS location from web page

There is no direct method natively built in Javascript stack. Don't give up though. I am giving your few lines of code to provide the result you look for. The code runs well on IE9, Chrome, FireFox, Safari on both PC and mobile device platforms.

 
function requestGeoLocation() {
 if (navigator.geolocation) {
 navigator.geolocation.getCurrentPosition(function(loc){
 // do nothing
 //document.getElementById('myloc').innerHTML = 'Location: ' + 
 //    loc.coords.latitude + ', ' +
 //    loc.coords.longitude;
    
        }, function() { alert('request denied or something went wrong.');});
} else { 
 alert('GPS is supported.'); 
}
 

28 comments:

  1. This is a good post. This post give truly quality information. I’m definitely going to look into it. Really very useful tips are provided here. thank you so much. Keep up the good works.
    java training in tambaram | java training in velachery

    java training in omr | oracle training in chennai

    java training in annanagar | java training in chennai

    ReplyDelete
  2. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

    rpa training in Chennai | rpa training in pune

    rpa online training | rpa training in bangalore

    ReplyDelete
  3. Outstanding blog post, I have marked your site so ideally I’ll see much more on this subject in the foreseeable future.
    python training in pune
    python online training
    python training in OMR

    ReplyDelete
  4. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    Devops Training in Chennai

    ReplyDelete
  5. I likable the posts and offbeat format you've got here! I’d wish many thanks for sharing your expertise and also the time it took to post!!
    Data Science training in Chennai | Data science training in bangalore
    Data science training in pune| Data science online training
    Pyton training in Kalyan nagar

    ReplyDelete
  6. This blog is the general information for the feature. You got a good work for these blog.We have a developing our creative content of this mind.Thank you for this blog. This for very interesting and useful.
    java training in omr | oracle training in chennai

    java training in annanagar | java training in chennai

    ReplyDelete
  7. Nice information, valuable and excellent design, as share good stuff with good ideas and concepts, lots of great information and inspiration, both of which I need, thanks to offer such a helpful information here.
    python training in pune
    python training institute in chennai
    python training in Bangalore

    ReplyDelete
  8. Thanks for your informative article, Your post helped me to understand the future and career prospects & Keep on updating your blog with such awesome article.
    Best Devops Training in pune
    Devops Training in Chennai

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. This comment has been removed by the author.

    ReplyDelete
  11. I am really enjoying reading your well written articles.
    It looks like you spend a lot of effort and time on your blog.
    I have bookmarked it and I am looking forward to reading new articles. Keep up the good work..
    Java Coaching Institutes in Bangalore
    Advanced Java Training Institute in Bangalore
    Best Institute For Java Course in Bangalore
    Java Training Classes in Bangalore

    ReplyDelete
  12. your blog information's are really creative and It contains full of new innovative ideas.thank you for sharing with us.please update more data.
    Selenium Training in OMR
    Selenium Training in Sholinganallur
    Selenium Training in Chennai
    Selenium Training in T nagar

    ReplyDelete
  13. This is a good post. This post give truly quality information. I’m definitely going to look into it. Really very useful tips are provided here. thank you so much. Keep up the good works.

    Ethical Hacking Course in Chennai 
    Hacking Course in Chennai 
    Ethical Hacking Training in Chennai 
    Best Python Training Institutes in Chennai
    Python Training courses
    Python Training classes in Chennai

    ReplyDelete
  14. I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.

    devops online training

    aws online training

    data science with python online training

    data science online training

    rpa online training

    ReplyDelete
  15. Attend The Python training in bangalore From ExcelR. Practical Python training in bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Python training in bangalore.
    python training in bangalore

    ReplyDelete
  16. Your astounding wise data involves a lot to me and particularly to my friends. Much obliged a ton; from us all.
    data science course noida

    ReplyDelete
  17. virtual event platform Ok we know that knowing our audience is necessary but how does this translates to reality. Marketing offers us various techniques to approach this matter. Segmentation is the first tool we need to use to identify at least three target markets on which we could build our next steps. team outing email template, short bio example yourself and subject for thank you email

    ReplyDelete
  18. I wish more writers of this sort of substance would take the time you did to explore and compose so well. I am exceptionally awed with your vision and knowledge. business analytics course in kanpur

    ReplyDelete