Jack Johnson
Jack Johnson

Reputation: 611

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!.

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...

Upvotes: 0

Views: 764

Answers (1)

tmcw
tmcw

Reputation: 11882

See the sanitizer option to markerLayer. HTML that goes through markers/mapbox.js is sanitized by default to prevent people from writing href="javascript:evilXSSAttack()".

Upvotes: 1

Related Questions