+ Reply to Thread
Results 1 to 2 of 2

Thread: Sent Current Location Like a Message

  1. #1
    Junior Member
    Join Date
    Aug 2021
    Posts
    3

    Sent Current Location Like a Message

    Hello.

    I need to add an option on messages.

    Sent Location button like in picture

    sendlocation message.png

    And when the the button location is clicked, I will send Current Location like message.
    I tried using navigator.geolocation but i didnt get it.

    Can anyone help in this idea !

  2. #2
    Junior Member
    Join Date
    Aug 2021
    Posts
    3
    I find something, maybe I'm classer to the desired result.

    <input type="button" id="btnView" value="Location" onclick="showPosition();" />

    <script type="text/javascript">
    {literal}
    function showPosition() {
    if(navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function( position) {
    var possinf = "https://www.google.com/maps/?q=" + position.coords.latitude + "," + position.coords.longitude;
    document.getElementById("message_text").value = possinf;
    });
    } else {
    alert("Sorry, your browser does not support HTML5 geolocation.");
    }
    }
    {/literal}
    </script>
    But, I need this text to be clickable on messages, like a link
    For the moment I see just like a text, so I need to copy and paste in browser to open the location marked
    Like in a picture

    sendlocationsucced.png

+ Reply to Thread