Skip to main content

Geolocation Support - Iframe Mode

Geolocation support enhances the user experience by automatically detecting the user's location and providing location-based services.

Enable Geolocation API

This is recommended when you initialize Same Day App as an Iframe. On your iframe tag, add an attribute of allow="geolocation *".

HTML Iframe Implementation

<body>
<iframe id="iframe" allow="geolocation *" src="https://schedule.jarvisanalytics.com/sameday/{company_slug}"
style="width: 100%; height: 1024px; min-height: 500px; border: none"></iframe>
</body>

JavaScript Dynamic Iframe Creation

<body>
<script>
(function () {
var referrer = document.referrer;
iframe = document.createElement("iframe");
iframe.setAttribute( "src", "https://schedule.jarvisanalytics.com/frame/{company_slug}&referrer=" + referrer );
iframe.setAttribute("class", "my-custom-class");
iframe.setAttribute("allow", "geolocation *");
iframe.style.width = 100 + "%";
iframe.style.height = 100 + "%";
iframe.style.border = "none";
document.getElementById("container").appendChild(iframe);
})(); </script>
</body>

Why Enable Geolocation?

Enabling geolocation API for your Same Day App iframe provides several benefits:

Automatic Location Detection

  • Browser-based geolocation API integration
  • GPS and network-based location detection
  • Fallback to IP-based location estimation

Location-Based Services

  • Find nearest office locations
  • Sort offices by distance
  • Pre-fill location information
  • Show travel time estimates

Implementation Notes

Required Configuration

  • allow="geolocation *": HTML attribute for iframe permissions
  • Replace {company_slug} with your actual company identifier

Container Setup

For the JavaScript implementation, ensure you have a container element:

<div id="container" style="width: 100%; height: 600px;"></div>