By default feature layers hosted on ArcGIS Online do not allow you to insert links into fields because it could be "harmful". This code snippet allows you to edit the service definition of a feature layer to allow links to be added to fields.
Created
February 29, 2024 23:34
-
-
Save HaydenElza/e5edbda817bb69618a308cdf60a9f7c0 to your computer and use it in GitHub Desktop.
Disable xss prevention for Esri feature service.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Allow html links in fields | |
from arcgis.features import FeatureLayerCollection | |
item = gis.content.get("c65363c5bfe54817b1985e69a8a3052f") | |
flc = FeatureLayerCollection.fromitem(item) | |
updated_properties = {"xssPreventionInfo": { | |
"xssPreventionEnabled": False | |
}} | |
flc.manager.update_definition(updated_properties) | |
flc.properties |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment