onclick event attribute in feature description removed from HTML
We are trying to add an onclick event to a link in the feature description of a layer. The event will execute some JavaScript code as follows:

<a onclick="alert('hello!');">link</a>
In the viewer, the link is created in however its onclick event is not triggered when the link is clicked. When inspecting the element in the developer tools, it looks like the attribute has been removed:

Our application uses Viewer for HTML5 2.6.1. We have added onclick events to links in Viewer for HTML5 2.5 in the past. We can verify that it works in version 2.5 and the attribute is not removed.
Thanks,
Joe
0
-
Hi Joe,
This is a result of anti-cross site scripting code that was added to the viewer in version 2.6.0. Please refer to the GVH Admin guide and the section called "20 Protecting Against Malicious Code" for details. Unfortunately this is a security feature and not something that can be turned off.
Regards,
Wayne Richard
Latitude Geographics Group Ltd.
Head Office: 300 – 1117 Wharf Street Victoria, BC Canada V8W 1T7
Tel: (250) 381-8130 | Fax: (250) 381-8132 | wrichard@latitudegeo.com
Developers of Geocortex web-based mapping software | www.geocortex.com
An Esri Platinum Business Partner0 -
You could implement NavigateToUri as discussed here:
https://support.geocortex.com/essentialsGSCForum?sub-nav=forum&main-nav=essentials&#!/feedtype=SINGLE_QUESTION_DETAIL&criteria=ALLQUESTIONS&id=9066000000006LnAAI0
Please sign in to leave a comment.
Comments
2 comments