ESRI JS API 正在剥离 href

ESRI JS API is stripping hrefs

ESRI 的 JS API 似乎正在剥离 URL 的 href。

这里我设置了静态link。然后我试图把它放在描述中。 link 文本和 target="blank" 已呈现,但 link 的 href (test/) 为空白!

    {% for project in projects %}

    var link = "<a target='blank' href='test'>Legal Description</a>";
    console.log(link) // This prints as expected with href intact.

    var attributes = {
        Name: "{{project.description}}",
        Description: link // strips out the href?!?!?!?!
    }

它应该是 localhost:8000/projects/test 但没有测试 href。

arcgis-js-api sanitizes html content in popups for security reasons. I'm not sure how you're defining your popups or using the attributes variable, but you'll want to create a PopupTemplate 及其 content 属性 来做你想做的事。您可以按照链接文章的建议进行操作,也可以使用 CustomContent 实例作为 popupTemplate content 属性.