UP TO 35% OFF!


  • Home
  • The HTML5 Geolocation API (Browser Location)

HTML5 Geolocation API Based content


The HTML5 Geolocation API-based content option is an alternative method for presenting location-specific content. This approach is significantly more accurate in determining the user’s location compared to the IP-to-location method (which is not crucial at the country and state level, but might be significant at the city level).

The drawback of this approach is that it necessitates the user’s consent to share their location.

How does the HTML5 Geolocation API work

The HTML5 eolocation API is a browser-based technology that enables us to determine the user’s geographical location with high accuracy. Upon receiving the users’ consent to share their location, the browser automatically provides the website with the user’s latitude and longitude coordinates. We then utilize a third-party database to translate the coordinates into relevant location information, such as city, state, country, or continent.

Note: Unlike our IP-to-location service, the HTML5 Geolocation API does not support timezone-based conditions.

What happens after the user’s permission to share his location

Users who give their permission to share their location will receive location-based content based on the HTML5 Geolocation API, while users who haven’t granted their permission will be served with location-based content based on our IP-to-location service.

Select when to request location-sharing permission

When utilizing the HTML5 Geolocation API, you have control over when and how you ask users for permission:

  1. Never: In case you don’t want to use the Geolocation API.
  2. Using a shortcode: Prompt when the user encounters the shortcode .
  3. The first time the user encounters geo-targeted content: whether it’s a geolocation condition, a geolocation DKI shortcode, or any other geolocation-based content.
  4. Upon the first visit: this refers to the initial time a user accesses a page on your site, regardless of whether any geolocation-based content exists on the page.

Various options to deliver location-specific content using If-So

The geolocation API service works with any method If-So offers to display geotargeted content, including:

Conditional Gutenberg blocks
Conditional Elementor elements
CSV Extension
Geolocation DKI shortcodes


Is the HTML5 Geolocation API (browser location) more accurate than IP-to-location services?

Yes, the Geolocation API is a much more accurate method. IP-to-location services are not 100% accurate. While their accuracy is higher at the country and state levels, it becomes less consistent at the city level. Learn more about IP-to-location services and their accuracy.

Do I need to set up another trigger/condition if I want to use the HTML5 Geolocation API instead of the IP-to-location service?

No, you should only set up the targeted content once. If-So handles everything automatically – users who grant permission to access their location will be served content based on the HTML5 Geolocation API service, while users who don’t grant permission will receive content based on the IP-to-location service.

Ready to get started?
Try it on your website