Search code examples
grailsgsp

Using the Grails2 resource Plugin, how do I prevent escaping in the r:img tag when including arguments in javascript?


This:

<r:img uri="${it.iconPath}" onclick="goOpenIt('${it.url}')"/>

becomes this:

<img src="/myapp/static/images/icon_32.png" onclick="goOpenIt(&#39;http://yahoo.com&#39;)" />

I want this:

<img src="/myapp/static/images/icon_32.png" onclick="goOpenIt('http://yahoo.com')" />

Solution

  • I'm afraid you can't. For groovy tags every attribute's value is rendered with encodeToHTML(). Post answer if you find other solution for this.