<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Map Viewer Classic: popup is escaping HTML in Arcade expression in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/map-viewer-classic-popup-is-escaping-html-in/m-p/1347573#M55767</link>
    <description>&lt;P&gt;I am stuck using the Map Viewer Classic because a group I work with requires it and isn't budging. I'm trying to get an Arcade expression to produce HTML and present it in the popup, but the popup is escaping the HTML and displaying the source code. I have a layer in a webmap with a popup configured like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dcafdg_0-1699510201770.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/85469iEFB232D7049A093C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dcafdg_0-1699510201770.png" alt="dcafdg_0-1699510201770.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Clicking on the "CONFIGURE" button, my popup looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dcafdg_1-1699510283985.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/85470iBF646D5523936375/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dcafdg_1-1699510283985.png" alt="dcafdg_1-1699510283985.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As you can see above, I've used the editor's bold button to create bold font, which is configuring HTML for the popup. But I also need my Arcade expressions to produce some HTML formatting. Here is the code for &lt;FONT face="courier new,courier" color="#993300"&gt;expression/expr0&lt;/FONT&gt;. The code receives a JSON dictionary from the field and formats it as a bulleted list in HTML.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var popup = '&amp;lt;ul&amp;gt;\n'
var fieldDict = Dictionary($feature["Field_Offices"]);
for (var sid in fieldDict) {
    Console('Inside Level loop')
    var record = fieldDict[sid];
    popup += `&amp;lt;li&amp;gt;${sid}: ${record['office_name']}\n`;
}
popup += '&amp;lt;/ul&amp;gt;\n'
return popup&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code is producing all the values I want, but the popup is escaping the HTML tags, so it shows the HTML source, rather than rendering the bulleted list:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dcafdg_2-1699510578304.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/85471i7E9B3C84760126E0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dcafdg_2-1699510578304.png" alt="dcafdg_2-1699510578304.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;How do I make this popup render the HTML?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bonus question: The &lt;FONT face="courier new,courier" color="#993300"&gt;Console()&lt;/FONT&gt; function works great in the new map viewer, but does absolutely nothing in Map Viewer Classic (it's in my expression, above). Is there a trick to get that to log to the developer tools console?&lt;/P&gt;</description>
    <pubDate>Thu, 09 Nov 2023 06:33:05 GMT</pubDate>
    <dc:creator>davedoesgis</dc:creator>
    <dc:date>2023-11-09T06:33:05Z</dc:date>
    <item>
      <title>Map Viewer Classic: popup is escaping HTML in Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/map-viewer-classic-popup-is-escaping-html-in/m-p/1347573#M55767</link>
      <description>&lt;P&gt;I am stuck using the Map Viewer Classic because a group I work with requires it and isn't budging. I'm trying to get an Arcade expression to produce HTML and present it in the popup, but the popup is escaping the HTML and displaying the source code. I have a layer in a webmap with a popup configured like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dcafdg_0-1699510201770.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/85469iEFB232D7049A093C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dcafdg_0-1699510201770.png" alt="dcafdg_0-1699510201770.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Clicking on the "CONFIGURE" button, my popup looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dcafdg_1-1699510283985.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/85470iBF646D5523936375/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dcafdg_1-1699510283985.png" alt="dcafdg_1-1699510283985.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As you can see above, I've used the editor's bold button to create bold font, which is configuring HTML for the popup. But I also need my Arcade expressions to produce some HTML formatting. Here is the code for &lt;FONT face="courier new,courier" color="#993300"&gt;expression/expr0&lt;/FONT&gt;. The code receives a JSON dictionary from the field and formats it as a bulleted list in HTML.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var popup = '&amp;lt;ul&amp;gt;\n'
var fieldDict = Dictionary($feature["Field_Offices"]);
for (var sid in fieldDict) {
    Console('Inside Level loop')
    var record = fieldDict[sid];
    popup += `&amp;lt;li&amp;gt;${sid}: ${record['office_name']}\n`;
}
popup += '&amp;lt;/ul&amp;gt;\n'
return popup&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code is producing all the values I want, but the popup is escaping the HTML tags, so it shows the HTML source, rather than rendering the bulleted list:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dcafdg_2-1699510578304.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/85471i7E9B3C84760126E0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dcafdg_2-1699510578304.png" alt="dcafdg_2-1699510578304.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;How do I make this popup render the HTML?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bonus question: The &lt;FONT face="courier new,courier" color="#993300"&gt;Console()&lt;/FONT&gt; function works great in the new map viewer, but does absolutely nothing in Map Viewer Classic (it's in my expression, above). Is there a trick to get that to log to the developer tools console?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 06:33:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/map-viewer-classic-popup-is-escaping-html-in/m-p/1347573#M55767</guid>
      <dc:creator>davedoesgis</dc:creator>
      <dc:date>2023-11-09T06:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: Map Viewer Classic: popup is escaping HTML in Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/map-viewer-classic-popup-is-escaping-html-in/m-p/1347628#M55770</link>
      <description>&lt;P&gt;I believe it is not possible to use html injection in Arcade. It could be considered a security risk.&lt;/P&gt;&lt;P&gt;Have a look at the following &lt;A href="https://community.esri.com/t5/arcgis-online-questions/arcade-hyperlink-from-field-as-text/td-p/696075" target="_blank" rel="noopener"&gt;thread.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Also, this &lt;A href="https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/combining-arcade-and-html-for-a-real-life-pop-up-display/" target="_blank" rel="noopener"&gt;blog post&lt;/A&gt; may be of interest.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 11:34:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/map-viewer-classic-popup-is-escaping-html-in/m-p/1347628#M55770</guid>
      <dc:creator>JonathanNowlan</dc:creator>
      <dc:date>2023-11-09T11:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: Map Viewer Classic: popup is escaping HTML in Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/map-viewer-classic-popup-is-escaping-html-in/m-p/1348738#M55841</link>
      <description>&lt;P&gt;Thanks for your response. Arcade producing HTML works great in the new map viewer, as long as you stick to the &lt;A href="https://doc.arcgis.com/en/arcgis-online/reference/supported-html.htm" target="_self"&gt;supported tag list&lt;/A&gt;. You can also do a fair amount with CSS, though I haven't figured out how to create reusable styles, so I have to define them anew for each element in my popup.&lt;/P&gt;&lt;P&gt;I had seen that blog post, but not that other thread. The issue is that I need to iterate through a series of JSON values in my attributes, so I can't just use the rich text editor or the HTML mode; I need Arcade, which is getting escaped. I did this in the new map viewer and it's working brilliantly, but I have a stakeholder whose whole workflow still revolves around Map Viewer Classic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2023 16:50:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/map-viewer-classic-popup-is-escaping-html-in/m-p/1348738#M55841</guid>
      <dc:creator>davedoesgis</dc:creator>
      <dc:date>2023-11-13T16:50:42Z</dc:date>
    </item>
  </channel>
</rss>

