My Location Widget not working on Web App

5034
18
Jump to solution
12-09-2016 01:29 PM
EthanUnzicker1
New Contributor III

I've added the My Location widget to a web app, but it doesn't seem to work at all. I have tried in several browsers on my Mac and on my iPhone, and I have not seen my location indicated at all.

Is there something else I need to do besides just adding the widget to my app?

Link to my app ArcGIS Web Application 

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Ethan,

   Chrome and Safari has required your website to use https for geolocation so the location widget does not function without your site being https protocol. This documented here:

LocateButton | API Reference | ArcGIS API for JavaScript 3.18 

There are security considerations to be taken into account when working with geolocation. Each web browser handles security differently. For example, if working with a later version of Chrome, you must host it via HTTPS. If hosted via HTTP, the application will load minus the Locate widget button. Although for testing purposes, it is still possible to host via http://localhost. For additional information regarding these security considerations, please see the ArcGIS blog, Increased web API security in Google Chrome.

The WAB team has yet to update their documentation with a note on this subject though.

jsong-esristaff

View solution in original post

18 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Ethan,

   Chrome and Safari has required your website to use https for geolocation so the location widget does not function without your site being https protocol. This documented here:

LocateButton | API Reference | ArcGIS API for JavaScript 3.18 

There are security considerations to be taken into account when working with geolocation. Each web browser handles security differently. For example, if working with a later version of Chrome, you must host it via HTTPS. If hosted via HTTP, the application will load minus the Locate widget button. Although for testing purposes, it is still possible to host via http://localhost. For additional information regarding these security considerations, please see the ArcGIS blog, Increased web API security in Google Chrome.

The WAB team has yet to update their documentation with a note on this subject though.

jsong-esristaff

View solution in original post

RVG296
by
Occasional Contributor

Robert Scheitlin, GISP

Mine is a slightly different scenario. My ArcGIS Javascript API location widget is working well in the WebApp (Calcite Maps Styler Template). But when I embedded the web app to our website using iframe then this location widget is not working. I don't even get a prompt from chrome "to allow access" when I am clicking on this widget in the app that is embedded in our website using an iframe. Any help on this is appreciated..!! Thank you.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Rohit,

   I just tested a WAB site inside an iframe that uses a https url from the same machine as the html page that contains the iframe (that is also https) and it works fine. So do you have both urls using https and are they from the same origin.

The page can only be displayed in a frame on the same origin as the page itself.

X-Frame-Options - HTTP | MDN 

0 Kudos
RVG296
by
Occasional Contributor

Hi Robert,

The Iframe I am trying to embed is a configurable web app created in AGOL which has HTTPS and it does not reside in our production server. But our website is using HTTPS protocol which is coming from a production server. Here is a link to the iframe. WILDFIRES AND DISASTERS | TFS 

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Sorry I am not familiar with that template.

0 Kudos
RVG296
by
Occasional Contributor

Robert Scheitlin, GISP

Irrespective of the template, I am not able to understand why this widget is not working even if we have our WebApp and the Website both coming from a secured HTTPS protocol. Any thoughts on this?

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Rohit,

It’s proposed that by default the following permissions cannot be requested or used by content contained in cross-origin iframes:

  • Geolocation (getCurrentPosition and watchPosition)

Deprecating Permissions in Cross-Origin Iframes - The Chromium Projects 

So the answer to this issue is to export the template app out of AGOL and host on your web server so that the iframe has the same origin as the page that contains the iframe

0 Kudos
RVG296
by
Occasional Contributor

Hi Robert,

So they gave a workaround to use allow="geolocation" in the iframe, which eventually worked for me.

Thank you so much for throwing light on this to me.

Deprecate on-by-default Permissions in Cross-origin Iframes - Chrome Platform Status 

0 Kudos
GabrieleGARNERO1
New Contributor II

I have the same problem, but even with https I can not start the widget.
What settings should I select on my organization?

THANK YOU

Gabriele Garnero

0 Kudos