简体   繁体   English

向MapBox工具提示添加链接

[英]Adding a link to MapBox Tooltip

I really hope anyone of you are able to help me, as i've been on this for hours now without luck. 我真的希望你们中的每个人都能为我提供帮助,因为我已经花了好几个小时没有运气了。

I'm using mapbox.com api to generate a map on my end, but i can't seem to be able to add links to it!. 我正在使用mapbox.com api最终生成地图,但是我似乎无法为其添加链接!

So, if i for example do it like this: 因此,例如,如果我这样做:

properties: {
    title: 'Tooltip Title',
    description: '<a target="_blank" href="#modal"data-toggle="modal">Test</a>',
    'marker-size': 'large',
    'marker-color': '#35B070',
}

It will echo out the description as 它将回显说明为

<a>Test</a>

But if i do for an example 但是如果我举一个例子

properties: {
    title: 'Tooltip Title',
    description: '<a target="_blank" href="http://www.google.com/" data-toggle="modal">Test</a>',
    'marker-size': 'large',
    'marker-color': '#35B070',
}

It will echo out as: 它将回显为:

<a target="_blank" href="http://www.google.com/">Test</a>

Does anyone know how to manage this ?... Making me nuts... 有人知道如何管理吗?...让我发疯...

See the sanitizer option to markerLayer. 请参阅markerLayer的清理程序选项 HTML that goes through markers/mapbox.js is sanitized by default to prevent people from writing href="javascript:evilXSSAttack()" . 默认情况下,会清理通过markers / mapbox.js的HTML,以防止人们编写href="javascript:evilXSSAttack()"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM