Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting a raw string back for use in Javascript in Play Framework 2.0

I am currently trying to dynamically generate Javascript using a Scala object in my Play application, like so:

<script type="text/javascript">@JavascriptGenerator.generateChangingTextScript()</script>

This Javascript contains characters that Play wants to escape automatically, such as a quote ("). It automatically turns it into:

&quot;String goes here&quot;

rather than the desired:

"String goes here"

The Javascript being returned does not like this, and as such does not work. How do I tell Play to not do this?

Thanks.

like image 934
Guicer Avatar asked Apr 26 '12 01:04

Guicer


1 Answers

The Play 2 equivalent to Play 1’s ${"<".raw} is @Html("<").

like image 94
Julien Richard-Foy Avatar answered Oct 14 '22 16:10

Julien Richard-Foy