Link to Photo Long description "on error" not working
I have the following in my Long Description for a Cemetery Viewer in HTML 2.5 and 2.6 (critical item is in BOLD ) :
{NAME_FOR_SEARCH}<br/>Death Date: {DEATH_DATE_FOR_SEARCH}<br/>Date of Birth on Headstone: {GPS_BIRTHDATE}<br/><img src="{PHOTOPATH}" height="200" onerror="this.src='http://gis.greenvillesc.gov/Imagery/Cemetery/UnmarkedGrave.jpg' "/><br/>
Basically, what I want to happen is that if there isn't a photo url in the Photopath field, it will display a generic "unmarked grave image". When I toggle the long description from "Show Source", the unmarked grave image will display okay within Manager.
But in the Viewer on 2.6, the image will not display in the application. Just a broken image symbol. Developer tools aren't helping me any. It is like the "onerror" option doesn't work.
It works on the 2.5 viewer.
They are on separate servers. One (where doesn't work) with 4.5 GE, ArcGIS Server to 10.3.1, HTML 2.6 on windows 2012 R2.
Where it does work - HTML 2.5.1, GE 4.4.1, and ArcGIS Server 10.2.2, Windows server 2008
Has anyone run into this?
Thanks,
Carmen
0
-
Could you populate the PHOTOPATH field for the unmarked graves with the required URL instead? 0 -
We do something like what Rebecca is suggesting, and it works fine. 0 -
Yes, I thought about doing that.
But I would like to know if the "onerror" really no longer works because I thought about using it elsewhere in cases where it may not be practical to alter the database.
Thanks,
Carmen0 -
Carmen, did you get this figured out? It looks like you are missing a semi colon between the ' and the " at the end of the onerror tag: {NAME_FOR_SEARCH}<br/>Death Date: {DEATH_DATE_FOR_SEARCH}<br/>Date of Birth on Headstone: {GPS_BIRTHDATE}<br/><img src="{PHOTOPATH}" height="200" onerror="this.src='http://gis.greenvillesc.gov/Imagery/Cemetery/UnmarkedGrave.jpg'; "/><br/>
Also, you might want to add this.onerror=null; before your this.src so that there isn't an infinite loop in some browsers (ref: http://stackoverflow.com/questions/8124866/onerror-attribute-of-img-is-executing-javascript-to-change-image-but-it-did-n)
Marshall0 -
Carmen, did you find a solution to this? We are experiencing a very similar issue with onclick event attributes in links. For example: <a onclick="alert('hello!');">link</a>This works in Viewer for HTML5 2.5, however it does not work in 2.6. The onlcick attribute is being removed from the HTML in the viewer as follows:
0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
5 kommentarer