GEOLOCATION

Here the Javascript code available to be inserted in your web page to implement geolocation functionlities.

Please check the context of implementation for each of the functions.

ATTENTION: these functionalities use a 3rd party service with a traffic cap, reached limits you can face unexpected responses.



Code:


  /**
   * SQJS.hideElByGeoLocation
   * 
   * Hide the given web page Element for the specified geolocation
   * 
   * Context:
   * - Call it in the body of your webpage 
   * 
   * @param {string} id, the id of the element to hide 
   * @param {string} geoloc, the geolocation (country name) to hide the el for
   * @returns {void}
   * 
   * This function is part of SqueeJS.
   */
  function SQJS.hideElByGeoLocation(id, geoloc){};

  /**
   * SQJS.showElByGeoLocation
   * 
   * Show the given web page Element for the specified geolocation
   * 
   * Context:
   * - Call it in the body of your webpage 
   * 
   * @param {string} id, the id of the element to show
   * @param {string} geoloc, the geolocation (country name) to show the el for
   * @returns {void}
   * 
   * This function is part of SqueeJS.
   */
  function SQJS.showElByGeoLocation(id, geoloc){};



Usage example:


    <div id="div4italy" style="width:350px;background:blue;color:white;display:none;">div 4 Italy<br></div>
    <div id="div4spain" style="width:350px;background:yellow;color:black;display:none;">div 4 Spain<br></div>
    <div id="div4france" style="width:350px;background:cyan;color:black;display:none;">div 4 France<br></div>
    <div id="div4germany" style="width:350px;background:black;color:white;display:none;">div 4 Germany<br></div>
    <div id="div4usa" style="width:350px;background:gray;color:black;display:none;">div 4 Usa<br></div><br>
    <script>
    SQJS.showElByGeoLocation("div4italy","italy");
    SQJS.showElByGeoLocation("div4spain","spain");
    SQJS.showElByGeoLocation("div4france","france");
    SQJS.showElByGeoLocation("div4germany","germany");
    SQJS.showElByGeoLocation("div4usa","united states");
    </script>



How it looks like: