PROBLEM
Public users can access a publicly shared web map from ArcGIS Online when it is embedded in a website. Before embedding the map in the website, the web map view can be configured by checking the Basemap Selector, Zoom Control, Home Button, View Larger Map, Disable Scroll Zoom, Scale Bar, Location Search, Map Details, Legend, and Preview Image options.
Sometimes, when the web map is embedded in a website with the Basemap Selector option checked, it prompts for a login.
If an organization does not allow anonymous access, public users are unable to access the web map through the embedded code URL that contains the organization's short name. However, although the organization has anonymous access enabled, public users may get prompted to login when accessing the web map only when it is embedded. This is because the organization is using a custom group as the basemap gallery, which is not publicly accessible.
When accessing a map via a URL that contains the organization shortname, the basemap gallery honors the organization's settings. The basemaps from the group that this organization uses as the basemap gallery is visible. If the URL uses arcgis.com without an organization shortname, the basemap gallery uses Esri's default basemaps.
By default, the embedded code for the web map obtained from Map Viewer Classic includes the organization's short name in the URL as shown in the example below.
<style>.embed-container {position: relative; padding-bottom: 80%; height: 0; max-width: 100%;} .embed-container iframe, .embed-container object, .embed-container iframe{position: absolute; top: 0; left: 0; width: 100%; height: 100%;} small{position: absolute; z-index: 40; bottom: 0; margin-bottom: -15px;}</style><div class="embed-container"><iframe width="500" height="400" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" title="Sample Web Map" src="//testorg.maps.arcgis.com/apps/Embed/index.html?webmap=338771e9738b4a6f997110c7e8889304&extent=-80.9758,35.1663,-80.7222,35.2867&zoom=true&previewImage=false&scale=true&basemap_gallery=true&disable_scroll=true&theme=light"></iframe></div>;
Note: Ensure all layers and tables on the map are shared publicly. Refer to: ArcGIS Online: Share maps
Note: Enable the Allow anonymous access to the organization's website, <organization>.maps.arcgis.com option. Refer to: ArcGIS Online: Configure security settings
The image below shows a successfully embedded web map with the option to select custom basemaps from the basemap gallery.
Get help from ArcGIS experts
Download the Esri Support App