URL getting replaced with # in webmap

858
4
Jump to solution
02-25-2019 08:18 PM
deleted-user-7SLqM7dlvYNN
New Contributor III

I've got a webmap with a pop up enabled, with a custom attribute display configuration, using a href url call to another mobile app. The idea being a link from the pop up will call the other app with appropriate parameters e.g. appname://?asset=xyz

After clicking OK for the pop up config and saving the webmap the link works if I use the webmap immediately in a browser, until I refresh the page. In Explorer for ArcGIS the link fails and it isn't recognised as a hyperlink. When I view the webmap's JSON in ArcGIS Online Assistant the link is getting replaced with "#?asset=xyz"

Weirdly enough, if I use the same url in the Pop-up Media config, with an image, the link is retained and works fine. 

Any idea why appname:// is getting replaced with a '#'? Is there anyway to call a custom app from the Attributes area of a pop up?

Explorer for ArcGIS

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Mark Peacey‌,

This happens because "appname" is not a whitelisted app on AGOL and the URL is sanitized on Save (resulting in the #). Can you tell me which platform you are on (iOS or Android)? Here are the ways you can work around this:

1. Plaint text: You should be able to add the url to the custom description as-is "appname://?asset=xyz" and Explorer will display the URL as tappable (only on iOS). This is probably not ideal since you could end up with a quite large URL

2. Attribute expression: As Chris Counsell‌ mentioned here Feb 25, 2019 9:13 PM, you could potentially use an attribute expression. Unfortunately the currently released versions of Explorer do not support attribute expressions. This will come with the next release of Explorer.

3. Field substitution: This is likely your best option, given the current version that is available. This option involves creating a field in your data for the "custom_scheme" and then by calculating field for the "custom_scheme" to be "app name://?". You can then use field substitution in URL for your hyperlink "{custom_scheme}asset=xyz". On the device, the URL will then resolve to "appname://?asset=xyz"

Once the next version of Explorer is released, using attribute expression will be your best choice. This will allow you to also do proper encoding if your passing other information to your app that may have values that need to be percent-encoded (spaces, apostrophes, etc.). Here's a simple example of how you could encode your URL using attribute expression:

url = "arcgis-survey123://?itemID=44234&field:rname=" + $feature.Name
encoded_url = Replace(url, "'", "%27")
encoded_url

Feel free to reach out if you have other questions jwhitney@esri.com


					
				
			
			
				
			
			
				
			
			
				

View solution in original post

4 Replies
by Anonymous User
Not applicable

Hi Mark,
I believe this is a known limitation:
BUG-000118477: Reloading and saving a web map using HTML tags (URI .. 

There was a workaround to this issue by inserting the URI as a custom Attribute Expression. Refer steps below:

  1. In the Configure- Pop-up Pane, add a custom Attribute Expression:
  2. "ie:" where ie: being URI
  3. When added this will appear as '{expression/expr0} under Attribute Expressions
  4. In HTML space where we add URI, please replace URI with {expression/exrp0}
    • The line will look like:
      <a href="{expression/expr0}http://google.com">Open Google with schema</a>
    • Instead of
      <a href="ie:http://google.com">Open Google with schema</a>

This workaround succeeded on one occasion but not for a later attempt, so I wouldn't really expect it to work but may be worth a shot.

by Anonymous User
Not applicable

Mark Peacey‌,

This happens because "appname" is not a whitelisted app on AGOL and the URL is sanitized on Save (resulting in the #). Can you tell me which platform you are on (iOS or Android)? Here are the ways you can work around this:

1. Plaint text: You should be able to add the url to the custom description as-is "appname://?asset=xyz" and Explorer will display the URL as tappable (only on iOS). This is probably not ideal since you could end up with a quite large URL

2. Attribute expression: As Chris Counsell‌ mentioned here Feb 25, 2019 9:13 PM, you could potentially use an attribute expression. Unfortunately the currently released versions of Explorer do not support attribute expressions. This will come with the next release of Explorer.

3. Field substitution: This is likely your best option, given the current version that is available. This option involves creating a field in your data for the "custom_scheme" and then by calculating field for the "custom_scheme" to be "app name://?". You can then use field substitution in URL for your hyperlink "{custom_scheme}asset=xyz". On the device, the URL will then resolve to "appname://?asset=xyz"

Once the next version of Explorer is released, using attribute expression will be your best choice. This will allow you to also do proper encoding if your passing other information to your app that may have values that need to be percent-encoded (spaces, apostrophes, etc.). Here's a simple example of how you could encode your URL using attribute expression:

url = "arcgis-survey123://?itemID=44234&field:rname=" + $feature.Name
encoded_url = Replace(url, "'", "%27")
encoded_url

Feel free to reach out if you have other questions jwhitney@esri.com


					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
deleted-user-7SLqM7dlvYNN
New Contributor III

Thanks Chris Counsell‌ and Joel Whitney‌ for the details, much appreciated.

Chris I tried the Attribute Expression option and that works for AGOL and holds the url but as per Joel's post it doesn't get honoured in Explorer.

Joel, I tried:

1. The url wasn't tappable on iOS with v18.1.2 of Explorer - might be because I don't have an up to date version of the other app with the URL schema configured, so iOS doesn't recognise it?

2. Will be great when Explorer supports Attribute Expressions as it looks like the best method and will be very useful for multiple things.

3. Not really possible with these datasets as they're corporate layers used by multiple applications. For the time being we'll stick with the url link from the Media image and then update it when Explorer can use Attribute Expressions.

deleted-user-7SLqM7dlvYNN
New Contributor III

The next step is creating an offline version of the map, for Explorer for ArcGIS, with the same linking capability. I created an expression in the ArcGIS Pro pop-up:

"appname://?assetNumber=" + $feature.MXASSETNUM + "&location=" + $feature.MXLOCATION

I then linked that to an image, using the expression in the Hyperlink field, to emulate what we've got in the online webmap. This looked like it was going to work brilliantly until I checked the URL that's being passed to the web browser and it's "appname:///?assetNumber=13136675&location=ACW-TP807688" < the URL has a third '/' in it. If I use one of Esri's default app schema's, which appear to be whitelisted as they can be used directly in the hyperlink field, it appears to launch the app correctly. Any ideas? Is this a bug or security restriction on non-whitelisted URLs?

ArcGIS Pro

0 Kudos