How to enable the locate widget.

1959
2
Jump to solution
01-26-2017 06:49 AM
MelissaPrindiville
New Contributor III

I'm using the Shortlist Story Map latest version and I want to enable the locate widget.

I've added this:

var geoLocate = new LocateButton({
map: app.map,
highlightLocation: false
}, "LocateButton");

geoLocate.startup();

to the custom-scripts.js

and added a div to the index

<div id="LocateButton"></div>

Using the following as reference.  Locate Button | ArcGIS API for JavaScript 3.19 

However I still don't see it appearing in the app.

0 Kudos
1 Solution

Accepted Solutions
RupertEssinger
Frequent Contributor

Hi Melissa

Just checking: are you launching the Shortlist containing the Locate button using https? 

My colleague Stephen Sylvia‌ writes:

If the URL starts with "http," you are loading you story on an insecure connection. Modern browsers will not provide a user's location to a website unless the website connects using a secure connection to prevent a hacker from stealing that user's location information. Because of this, we disable the locate button when the story is loaded via "http." 

(See https://community.esri.com/thread/189030-cant-display-locate-button-on-story-map-tour )

If you still have issues, let us know.

 

Note: in the next ArcGIS Online update (planned for the end of February, we'll be adding the "Locate me" button and the Addres/place/feature search control as options that authors can turn on in their hosted Shortlists, so you won't need to custom code and self-host a Shortlist in order to present those to your users. The limitation with the "Locate me" button will still apply.

Rupert

View solution in original post

2 Replies
RupertEssinger
Frequent Contributor

Hi Melissa

Just checking: are you launching the Shortlist containing the Locate button using https? 

My colleague Stephen Sylvia‌ writes:

If the URL starts with "http," you are loading you story on an insecure connection. Modern browsers will not provide a user's location to a website unless the website connects using a secure connection to prevent a hacker from stealing that user's location information. Because of this, we disable the locate button when the story is loaded via "http." 

(See https://community.esri.com/thread/189030-cant-display-locate-button-on-story-map-tour )

If you still have issues, let us know.

 

Note: in the next ArcGIS Online update (planned for the end of February, we'll be adding the "Locate me" button and the Addres/place/feature search control as options that authors can turn on in their hosted Shortlists, so you won't need to custom code and self-host a Shortlist in order to present those to your users. The limitation with the "Locate me" button will still apply.

Rupert

MelissaPrindiville
New Contributor III

Hi Rupert,

Launched the shortlist as an https using the latest version of the template.  I was wondering if there is a zoom functionality where it would zoom to my location?  it doesn't appear to do that know you have to use the + and - zoom buttons to find the blue dot.  

Can you point me to the code to implement the functionality?  Is this  on the developers radar for the next version?

thank you for your assistance.

0 Kudos